Question about unpack function

5 visualizaciones (últimos 30 días)
Lawren Lin
Lawren Lin el 23 de Mayo de 2017
Comentada: Steven Lord el 23 de Mayo de 2017
I've seen that unpack() can extract signals from message or extract object from signal logs, but I've seen that some code write like this:
if true
unpack(object)
end
What will this happen then? Unpack the object and return the values that return in 'object'?

Respuestas (1)

Walter Roberson
Walter Roberson el 23 de Mayo de 2017
unpack() from the Vehicle Area Network tools pretty much needs its output to be assigned.
The unpack methods for Simulink signal logs or tsarray objects writes into the MATLAB workspace https://www.mathworks.com/help/simulink/slref/unpack.html
  1 comentario
Steven Lord
Steven Lord el 23 de Mayo de 2017
Or to put it a little differently, the unpack function may be a plain function or it may be a method for one or more classes. MATLAB determines which version of the unpack function to call based on the inputs with which you call it, and different versions of unpack for different classes may do different things.
For instance, in MATLAB there is a function named factor that accepts a number and returns the prime factorization of a number (so factor(30) returns [2 3 5]). There is also a function named factor in Symbolic Math Toolbox that accepts a sym object and factors that object. The result returned by that function may be the prime factorization of a number stored as a sym or may be the factorization of a polynomial stored as a sym.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by