How to integrate 6 different variables into a struct?

1 vue (au cours des 30 derniers jours)
Metin Ertas
Metin Ertas le 19 Fév 2014
Commenté : Metin Ertas le 19 Fév 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.

Réponse acceptée

Mischa Kim
Mischa Kim le 19 Fév 2014
Modifié(e) : Mischa Kim le 19 Fév 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.
  1 commentaire
Metin Ertas
Metin Ertas le 19 Fév 2014
It worked perfect to my need. Thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Structures dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by