Export variables of for loop into an excel sheet
3 views (last 30 days)
Show older comments
for i = 0.01:0.01:0.04
A = i*5;
fprintf('%02d \n',A)
end
xlswrite('xlx.xlx',A);
How can I export the values into an excel sheet? Is this the correct formula?
0 Comments
Answers (1)
KL
on 10 Nov 2017
You probably want to store your loop iterations in an array.
A = zeros(1,10); %pre-allocate
for k=1:size(A,2) %use A's size
A(1,k) = k*10; %populate (do your computations)
end
xlswrite('filename.xls',A)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!