Condition and xlsread

3 views (last 30 days)
Pepa
Pepa on 17 Mar 2011
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

Accepted Answer

Laura Proctor
Laura Proctor on 17 Mar 2011
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.
  1 Comment
Pepa
Pepa on 17 Mar 2011
Thank you.
I needed "isempty".

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!