From: Cai Cheng on
Hi guys,
I am a starter in Matlab and I have faced a small problem.
I want to write the program so that some variable values can be writen into excel. eg. (A=12, B=14,C=15...)
However, since this program will be run many times and update each of the variables into excel. So Everytime, I need to writen in a new row to ensure there is no overwriting. for instant:

xlswrite('Z:\junk\new.xls',ProbeName,'Gain','A3');
xlswrite('Z:\junk\new.xls',GainPX(1),'Gain','B3');
xlswrite('Z:\junk\new.xls',GainNX(1),'Gain','C3');

However, since new.xls contain lots of those information (It will update each experiment result). Every time I run this program, I want it automatically find the correct address under the last update. The problem is I don't know how many update were in the excel so I cannot determine which row i will begin to write.

Is there any command so that I can find whats the last row of an excel document so that I can ensure where should I update my data to this excel file. Many Thanks.
From: dk on
Use xlsread.


On Jun 22, 1:27 pm, "Cai Cheng" <cheng19861...(a)hotmail.com> wrote:
> Hi guys,
> I am a starter in Matlab and I have faced a small problem.
> I want to write the program so that some variable values can be writen into excel. eg. (A=12, B=14,C=15...)
> However, since this program will be run many times and update each of the variables into excel. So Everytime, I need to writen in a new row to ensure there is no overwriting. for instant:
>
> xlswrite('Z:\junk\new.xls',ProbeName,'Gain','A3');
> xlswrite('Z:\junk\new.xls',GainPX(1),'Gain','B3');
> xlswrite('Z:\junk\new.xls',GainNX(1),'Gain','C3');
>
> However, since new.xls contain lots of those information (It will update each experiment result). Every time I run this program, I want it automatically find the correct address under the last update. The problem is I don't know how many update were in the excel so I cannot determine which row i will begin to write.
>
> Is there any command so that I can find whats the last row of an excel document so that I can ensure where should I update my data to this excel file. Many Thanks.