How to integrate 6 different variables into a struct?

1 Ansicht (letzte 30 Tage)
Metin Ertas
Metin Ertas am 19 Feb. 2014
Kommentiert: Metin Ertas am 19 Feb. 2014
I need a help on a very specific problem:
Assume that we have 6 variables and each has got different number of elements such as;
A=[1 2]; B=[1 2 3 4]; C=[]; D=[1 3 4 5 6]; E=[1]; F=[0 0 0 ];
I wan to keep them in a format like this:
New_form(: , i , j)
i represents the first three variables A, B and C j represents the last three variables D, E and F
when I wanted to call `D` for examples Newform(:,2,2) should be written.
The question is obvious: All variables have got different sizes and in mamtrix form it s no possible. But I am sure there must be a way to do it by using `struct` .But I couldnt ve managed to do it.

Akzeptierte Antwort

Mischa Kim
Mischa Kim am 19 Feb. 2014
Bearbeitet: Mischa Kim am 19 Feb. 2014
Metin, you could simply use a cell array. As an example:
New_form = {A D; B E; C F};
In this case D is accessed as
New_form{1,2}
first row, second column.

Weitere Antworten (0)

Kategorien

Mehr zu Structures finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by