save dataset in a specific exel sheet

hi everyone,
someone can tell me how can i save a dataset in a specific sheet from exel?
Thanks

 Accepted Answer

num = xlsread(filename,sheet)

2 Comments

I really mean save a dataset with the matlab function export. With funtion export i can save the dataset in Excel but i can´t choose the sheet.
export(DS,'XLSFile',FILENAME)
The xlsread don´t let me save a dataset, i don´t know why, but i use xlsread to matrix or vectors and works well.
Thanks
convert your dataset to cell then use xlswrite
M=dataset2cell(A) % A is your dataset
xlswrite('your_file.xlsx',M,sheet)

Sign in to comment.

More Answers (1)

Your wording is contradictory ("save from excel"). Not sure if you mean read from Excel or save to Excel, so I'll give both cases:
To retrieve a dataset from Excel ( into MATLAB), use
[numbers, textCells, rawCells] = xlsread(fullFileName, sheetname);
To save a dataset in a specific sheet to Excel ( from MATLAB to Excel)?
xlswrite(fullFileName, data, 'A1', sheetname);

3 Comments

I really mean save a dataset with the matlab function export. With funtion export i can save the dataset in Excel but i can´t choose the sheet.
export(DS,'XLSFile',FILENAME)
The xlsread don´t let me save a dataset, i don´t know why, but i use xlsread to matrix or vectors and works well.
Thanks
xlsread() does not send/export data from MATLAB to Excel. That's what xlswrite() does. Is there any reason why you think you must use export() instead of xlswrite() like Azzi showed you?
xlswrite doesn't work with dataset, so i' m trying use export function. Azzi answer Works. Thanks

Sign in to comment.

Asked:

on 8 Aug 2014

Commented:

on 11 Aug 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!