Matlab Script won't write to Excel past column Z?
Ältere Kommentare anzeigen
Hey guys, so I have a simple script that is part of a much larger program in MatLab. The simple script simply writes certain output to an Excel file:
function writevar(x,k,filename)
col = char(64+k);
N = size(x,1);
Rg = sprintf([col '1:' col '%i' ],N);
xlswrite(filename,x,Rg);
end
I'm writing over 100 individual things however the script gives an error and won't write past column Z. I'm using the script via the following:
writevar({randA{counter}},counter,filename);
If anyone could point out how to modify the script or my use of it to continue writing to Excel past the Z column that would be much appreciated!
Thanks.
Akzeptierte Antwort
Weitere Antworten (1)
Steven Lord
am 4 Jul. 2016
1 Stimme
The column after Z is AA. You need to modify your code that defines col to handle this. Or just omit the range and let xlswrite write starting at the upper-left corner and go as far as it needs to go.
3 Kommentare
Haissam Adil
am 4 Jul. 2016
wirat chiangkul
am 9 Aug. 2021
Hi,
is anyone find out how the solution is. i have a problem on this too. i'd like to generate data more than 26 column like AA, AB, AC and so on can anyone help?
Regards,
Walter Roberson
am 9 Aug. 2021
I posted links to two File Exchange contributions that accept a numeric column number and return a lettered column name.
Kategorien
Mehr zu Spreadsheets finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!