Why is it Showing this error?
Show older comments
Write a function called integerize that takes as its input a matrix A of integers of type double, and returns the name of the “smallest” signed integer class to which A can be converted without loss of information. If no such class exists, the string 'NONE' is returned. For example, if the smallest element of A is -100 and the largest is +100, then the function would return 'int8'. As another example, if there is an element of A equal to -1e20, then the function would return 'NONE'.
if true
% code
end
function s=integerize(A)
if (A<=127 && A>=-128)
s='int8';
else if(A<=32767 && A>=-32768)
s='int16';
else if (A<=2147483647 && A>=-2147483648)
s='int32';
else if (A<9223372036854775807 && A>-9223372036854775808)
s='int64';
else
s='NONE';
end;
* _Error: File: integerize.m Line: 6 Column: 10
At least one END is missing: the statement may begin here._*
1 Comment
David William Armstrong
on 11 Oct 2017
You need to end both the function and the if/else statement.
Accepted Answer
More Answers (0)
Categories
Find more on Whos 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!