MATLAB POLYSPACE 7 Guía de instalación Pagina 473

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 618
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 472
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
Vista de pagina 472
1 2 ... 468 469 470 471 472 473 474 475 476 477 478 ... 617 618

Comentarios a estos manuales

Sin comentarios