MATLAB Answers

error in writematrix command (using loop)

12 views (last 30 days)
Ivan Mich
Ivan Mich on 14 Feb 2021
Commented: dpb on 15 Feb 2021
I have a syntax problem with a code. I want to use writematrix command in order to get output files from my code. Previously in my code I use for in order to create a loop. I would like for each loop to create a specific output. I use
for z=1:size(d2,1) %d2 is a matrix from input file)
writematrix(A,'output',num2str(z),'.xlsx') % A is an output matrix I want to create
but command window shows me an error.
Could you please help me?
dpb on 15 Feb 2021
First does, too, if don't forget to add the other "+" after pasting original...
>> z=1;
>> "output"+z+".xlsx"
ans =
It doesn't have the nicety of the leading zero in the numeric field to ensure sorting in numeric order the other does, compose could take care of that.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!