フィルターのクリア

Repeat in counter

1 回表示 (過去 30 日間)
Michael
Michael 2011 年 7 月 11 日
I used a counter and an xlswrite function in a loop. For each iteration of the loop, a new value is calculated. I used the following counter so that for each round of the loop, the value would be pasted in the next consecutive cell below the previous:
blah = {'1';'2'};
count = 1;
for y = 1:length(blah)
fileid = [blah{y},'.csv]
data = xlsread(fileid);
***(((my calculations that produces X)))***
xlswrite('Data.xls', X, sprintf('A%i:A%i',count, count+1))
count = count+1;
end
The problem is that when it writes the value into the excel document for each loop it writes the same value in two consecutive cells each time. Any ideas on what I need to do to fix this?
Thanks!

採用された回答

Fangjun Jiang
Fangjun Jiang 2011 年 7 月 11 日
Well, you specified to write to A1:A2 for example, which is two cells. Try sprintf('A%i:A%i',count,count)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by