if statement to check if the first column of a cell matrix is empty or nor
Show older comments
Dear all,
I load an excel file into Matlab. For example:
[num,txt,raw]=xlsread('koi.xlsx');
data=num; % contains only numbers or empty cells
data=num2cell(data)
size1=size(data);
If the first column in "data" is empty i use
data=[zeros(size1(1,1) ,1) num2cell(data)]
if not, I use the initial output
data=num2cell(data)
But is is a bit painful to check every file to see if the 1rst column is empty or not
So, What I am looking for is something like
[num,txt,raw]=xlsread('koi.xlsx');
data=num; %
data=num2cell(data)
size1=size(data);
if data(:,1) is empty i fill it with an
data=[zeros(size1(1,1) ,1) num2cell(data)]
else
data=num2cell(data)
1 Comment
per isakson
on 2 Jul 2012
Why do you want to put numerical data into a cell array?
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!