Reputation: 31
I have a for loop
count=1
for i=4:10
xlswrite('error.xls', 'T', 'Target', ['A' num2str(count)]);
xlswrite('error.xls', testT, 'Target', ['B' num2str(count)]);
xlswrite('error.xls', 'O', 'Output', ['A' num2str(count)]);
xlswrite('error.xls', testy, 'Output', ['B' num2str(count)]);
count=count+1;
end
But its writing the value in different sheet. what I want is in the same sheet the value of testT starts from B1 to Q1(say)
and testy starts from B2 to Q2
and then for next iteration --- testT starts from B6 to Q6(say)
and testy starts from B7 to Q7..
I am not able to formulate the logic inside the for loop... so anybody who is good in this please help me out..
Upvotes: 1
Views: 2567
Reputation:
You have to write the data to the same sheet (say, 'Target') and increase the count
after writing to each row:
testT = 1:10;
testy = 1:10;
count = 1;
for i = 4:10
xlswrite('error.xls', 'T', 'Target', ['A' num2str(count)]);
xlswrite('error.xls', testT, 'Target', ['B' num2str(count)]);
count = count + 1;
xlswrite('error.xls', 'O', 'Target', ['A' num2str(count)]);
xlswrite('error.xls', testy, 'Target', ['B' num2str(count)]);
count = count + 1;
end
Upvotes: 1