Filling an excel spreadsheet as I am calculating values simultaneously?

I need help finding a way to fill up an excel sheet from calculation gradually as my function continues producing values from different loops. Is that possible?

6 Comments

Yes, it's possible. Did you try xlswrite?
Yes, I did but I change to writematrix() thinking it will do a better work but I continue to be stuck in the same spot. Also, I don't know if I can put them together in just one line of code. I tried but it didn't work the xlswrite() since I am using a Mac.
writematrix(FinThet3(:,1),'DataM.xls','Range','D3');
writematrix(FinThet3_C(:,1),'DataM.xls','Range','E3');
writematrix(FinThet4(:,1),'DataM.xls','Range','F3');
writematrix(Finthet4_C(:,1),'DataM.xls','Range','G3');
You'd be better off writing the data in one call but anyway, what's the problem with your code? If you get an error then give us the entire text of the error message, if it doesn't behave as you expected then how does it differ from your expectations?
I don't get an error. It want to fill those spaces in blank (in the picture bellow) whit its corresponding values (Columns A,B,C can repeat) for each Column D, E, F and G. Probably I have to remake the array and then fill up the excel. I though there were a function that would fill row by row with the information my arrays were getting from the calculations. The issue is my array that is filling up Columns A, B and C, it is always smaller than the rest.
"I though there were a function that would fill row by row with the information my arrays were getting from the calculations"
writematrix and co. will put whatever you want exactly where you tell it to. It won't take a guess at what else you want to put somewhere else. If you tell writematrix to put some data in a row, it'll put it in that row, so yes you can fill a file row by row. Note that it's not the most efficient way to go about, writing everything at once would make more sense), but it's certainly possible.
"The issue is my array that is filling up Columns A, B and C, it is always smaller than the rest."
So far, it doesn't appear that you write anything in column A, B, C, so nothing is going to end up there.
Yes, I do, sorry I didn't paste my code for those columns
writematrix(FL2(:,1),'DataM.xls','Range','A3');
writematrix(FL3(:,1),'DataM.xls','Range','B3');
writematrix(FL4(:,1),'DataM.xls','Range','C3');

Sign in to comment.

Asked:

on 10 Dec 2019

Answered:

on 13 Dec 2019

Community Treasure Hunt

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

Start Hunting!