Question about unpack function

4 次查看(过去 30 天)
Lawren Lin
Lawren Lin 2017-5-23
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'?

回答(1 个)

Walter Roberson
Walter Roberson 2017-5-23
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 个评论
Steven Lord
Steven Lord 2017-5-23
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.

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by