How can I write in excel multiple columns as vectors?

20 views (last 30 days)
First of all, thanks for reading this. Well, I have a gui that writes columns in a new excel spreadsheet concatenating them in a matrix, but I don't know how many columns will the user write in that excel file. I'm using xlswrite.
The sintax that I think I could use for concatenation is:
I hope I had been explicit with my question. Greetings.

Answers (2)

Sara on 8 Jul 2014
You can create dynamically the range to write to. For instance, starting from A1:
xlswrite('myfile.xlsx',Y, ['A1:',char(64+size(Y,2)),':',num2str(size(Y,1))])

Image Analyst
Image Analyst on 8 Jul 2014
Edited: Image Analyst on 8 Jul 2014
Simply create your Y any way you'd like, such as you did. Then call xlswrite
xlswrite(filename, Y, 'A1');
'A1' is the upper left cell in Excel where you want to put the upper left cell of your array - you can make it whatever/wherever you want. It doesn't care how many rows or columns are in Y - it will put them all in there. You don't need to do what Sara did, and you don't need to specify the lower right cell unless you want to export just a portion of Y and not the full array.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by