Installation guide
M-Lint Code Check Report
Messages and Resulting Changes for the lengthofline Example. The
following table describes each message and demonstrates a way to change the
file, based on the message.
Message — Code (Original Line Numbers)
Explanation and Updated Code (New
Line Numbers)
22: The value assigned here to
variable 'nothandle' might never be
used.
—————————————————
22 nothandle = ~ishandle(hline);
23 for nh = 1:prod(size(hline))
24 notline(nh) = ~ishandle(hline(nh))
...
In line 22, nothandle is assigned a valu e, bu t
nothandle is probably not used anywhere after
thatinthefile. Thelinemightbeextraneous
and you could delete it. But it might be that
you actually intended to u se the variable, which
isthecaseforthe
lengthofline example.
Update line 24 to use
nothandle,whichis
faster th a n computing
~ishandle for ea ch
iteration of the loop, as s h own he re.
22 nothandle = ~ishandle(hline);
23 for nh = 1:numel(hline)
24 notline(nh) = nothandle(nh) ...
23: NUMEL(x) is usually faster than
PROD(SIZE(x)).
—————————————————
23 for nh = 1:prod(size(hline))
While prod(size(x)) returns the number
of elements in a m atrix, the
numel function
wasdesignedtodojustthat,andthereforeis
usually more efficient. Type
doc numel to see
the
numel reference page. Change the line to
23 for nh = 1:numel(hline)
7-21