Question about unpack function
4 views (last 30 days)
Show older comments
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'?
0 Comments
Answers (1)
Walter Roberson
on 23 May 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 Comment
Steven Lord
on 23 May 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.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!