How to integrate 6 different variables into a struct?

1 visualización (últimos 30 días)
Metin Ertas
Metin Ertas el 19 de Feb. de 2014
Comentada: Metin Ertas el 19 de Feb. de 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.

Respuesta aceptada

Mischa Kim
Mischa Kim el 19 de Feb. de 2014
Editada: Mischa Kim el 19 de Feb. de 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.

Más respuestas (0)

Categorías

Más información sobre Structures en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by