Solved my own problem. i rewrote it and now it is working.
Why is >= not defined
12 views (last 30 days)
Show older comments
William Dever
on 24 Nov 2015
Commented: William Dever
on 24 Nov 2015
A_cutoff=input('Please enter you lowest grade for an A...');
B_cutoff=input('Please enter you lowest grade for an B...');
C_cutoff=input('Please enter you lowest grade for an C...');
D_cutoff=input('Please enter you lowest grade for an D...');
filename=input('please input file name');
[num, text, raw]=xlsread(filename);
b=[];
[c,d]=size(raw);
b=raw(:,d);
[k,l]=size(b);
B=[];
for m=1:k
for n=1:l
if b>=A_cutoff
B(k,n)='A';
elseif b>=B_cutoff
B(k,n)='B';
elseif b>=C_cutoff
B(k,n)='C';
elseif b>=D_cutoff
B(k,n)='D';
elseif b>=0
B(k,n)='F';
end
end
end
when i run this script it gives me the error of
"Undefined operator '>=' for input arguments of type 'cell'."
can not figure out why though. It works in other codes but not this one.
Accepted Answer
Walter Roberson
on 24 Nov 2015
You have
b=raw(:,d);
the raw output from xlsread is returned as a cell array, not as a numeric array. If you want the numeric array you should be looking at the num output.
Hint: notice that you never change b inside your for loops. Perhaps you should be examining the content of individual cells. But before doing a numeric comparison you have to know that what you are comparing to is numeric rather than string, because cell arrays can contain strings...
0 Comments
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!