writing series values in excel file columns using matlab

Q :\ i need to write values in excel file columns , where my code is successfully write values from column A to columns Z and if my values exceed that char which mean more than 26 values its give me writing error because the column name after column z is AA , AB , AC .. and so on , i need to write values in these columns how we can do that please ?
i use the following code for long time
row_range = '2';
column_range = 'B';
for i:1 length(file list)
file_range = strcat(row_range ,column_range);
xlswrite('D:\wilyam.xls',{images}, 'Sheet1', file_range);
column_range = char(column_range + 1);
end
row_range = char(row_range + 1); %Moving to the next row
Q:\ how we can we write in columns AA , AB , AC ,,,, etc ?

回答 (1 件)

Morteza
Morteza 2015 年 8 月 19 日

0 投票

Here is the simple way:
x = {'Enter name for excel file :'};
y = 'Entery.';
z = 1;
o = {''};
options.Resize = 'on';
options.WindowStyle = 'normal';
options.Interpreter = 'tex';
answer = cell2mat(inputdlg(x,y,z,o,options));
if isempty(answer) == 1
return
end
ndata = rand(50);
[S,W] = size(ndata);
str = nan(S+1,W+1);
Time = num2cell(zeros(S,1));
STR = num2cell(zeros(1,W));
for i = 1:S+1
for j = 1:W+1
if i ~= 1
if j ~= 1
str(i,j) = ndata(i-1,j-1);
end
end
end
end
xlswrite(answer,str );

1 件のコメント

ahmed obaid
ahmed obaid 2015 年 8 月 19 日
thank you sir for your reply ,,, sir is there any method to deal with columns and rows as numbers for example instead of char(column-range+1) can use any other expression to write an values one by one in each column cell ,, my values are 50 values ... thanks

サインインしてコメントする。

質問済み:

2015 年 8 月 19 日

コメント済み:

2015 年 8 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by