Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Displaying array in a cell
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to copy an already existing column vector into a cell array and have it display as a column when I import in excel using xlswrite. Here is my code.
Table={'Gray Shade','Digital Units','LE 100% Night','LE 50% Night'; grayShade digUnits stepsN100L stepsN50L);
xlswrite('Gamma Stability.xlsx', Table, 'Gray Shade Table', 'B2');
What I am trying to get is for the first four entries in Table to be the column headers and for the last four to be the data after the columns. The variables grayShade, digUnits, stepsN100L, and stepsN50L are all 17 rows by 1 column in size. When I execute this command, it writes Table, but it comes out as a 2x4 cell array with the column headers in the first row, and every cell in the second row saying '17x1 double'. Not sure how to make it write in the actual data. I would like my cell array to be an 18x4 when I am done.
0 Kommentare
Antworten (1)
Jan
am 29 Apr. 2013
Table = cat(1, ...
{'Gray Shade','Digital Units','LE 100% Night','LE 50% Night'}, ...
mat2cell([grayShade digUnits stepsN100L stepsN50L]));
2 Kommentare
Jan
am 30 Apr. 2013
@Alex: And then you started to analyse what's going on, correctly? Or are you waiting for me?
I cannot know the dimensions of grayShade etc., therefore I cannot guess, how this command have to look like exactly. But you have all information about this, to I encourage you to try to solve it. Perhaps you want:
mat2cell([grayShade(:), digUnits(:), stepsN100L(:), stepsN50L(:)])
You cannot simply omit the "...", which are the line continuation makr in Matlab.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!