Condition and xlsread

2 次查看(过去 30 天)
Pepa
Pepa 2011-3-17
Hallo,
how can i put xlsread to condition?
If label (value) doesn´t exist that it do something.
For example:
if(xlsread(excel,'7.1_1_a',sprintf('AC%d',j))==??? || xlsread(excel,'7.1_1_u',sprintf('AC%d',j))==??? || xlsread(excel,'7.1_1_i',sprintf('AC%d',j))==???)
lol = 0;
else
script2 (excel);
end

采纳的回答

Laura Proctor
Laura Proctor 2011-3-17
I think that if you're simply looking to see if there is data in the cell, you can just use the ISEMPTY function. Something like this:
xlswrite('test.xls',magic(2))
if isempty(xlsread('test.xls','Sheet1','A4'))
disp('The cell is empty')
else
disp('The cell contains a value')
end
Although, it would probably be better, since you're using XLSREAD anyway, to read the data into a variable.
What is your goal? Maybe I can be of more help if I better understand what you are trying to do.

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by