Vector inside a vector?
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
triges
am 14 Feb. 2015
Bearbeitet: John D'Errico
am 14 Feb. 2015
Hi
I'd like to know if it is possible to assign a vector to an existent vector element, for example:
syms t v variables=[t v]; vector=[1 2 3; 4 5 6]
and assing to the element t the values [1 2 3] and to v the values [4 5 6], so that the new vector is [t,v] with their values [1 2 3], [4 5 6].
0 Kommentare
Akzeptierte Antwort
John D'Errico
am 14 Feb. 2015
Bearbeitet: John D'Errico
am 14 Feb. 2015
A qualified no. You cannot assign anything but a scalar element to a simple array in MATLAB.
Or a qualified yes, IF the array or matrix you will store it in is a cell array, then yes, you can do as you wish. Note that working with cell arrays is not quite so simple though, as you cannot do arithmetic on those elements until you extract them form the cells that hold them. You can also use tools like cellfun.
You can also assign anything you wish to fields of a structure, so that may be an alternative to use.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Operators and Elementary Operations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!