Matlab Script won't write to Excel past column Z?
Afficher commentaires plus anciens
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.
Réponse acceptée
Plus de réponses (1)
Steven Lord
le 4 Juil 2016
1 vote
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 commentaires
Haissam Adil
le 4 Juil 2016
wirat chiangkul
le 9 Août 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
le 9 Août 2021
I posted links to two File Exchange contributions that accept a numeric column number and return a lettered column name.
Catégories
En savoir plus sur Spreadsheets dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!