How can I access a cell array's data from another cell array?

3 vues (au cours des 30 derniers jours)
Federico Manchini
Federico Manchini le 24 Mar 2019
Commenté : Walter Roberson le 24 Mar 2019
Hello. First of all, sorry if I'm not clear, english is not my native tongue... I have the next problem: I made a for loop to create X different inputdlg with 6 different boxes to complete in each one. Let's say X=3.So I ended up with a 3x1 cell array, and in each position ({1,1}, {2,1} and {3,1}) I have a 6x1 cell array as well. Now I have to convert the 6x1 cell array into ordinary arrays. I know there's a function called cell2mat to do this. But it only works if I indexed the three 6x1 cell arrays separately first.
Here's an example:
a = {{1;2;3;4;5;6};{7;8;9;10;11;12};{13;14;15;16;17;18}} % with x=3 and having already completing the 6 different boxes in my inputdlg text boxes
% if I write
b = a{1,1};
c = a{2,1};
d = a{3,1};
% and
e = cell2mat(b);
f = cell2mat(c);
g = cell2mat(d);
I have the ordinary arrays I want: e, f and g. And I can work with them now. But I don't know the value of X, it's assumed to change depending on different circumstances. So I need a for loop to get as many ordinary arrays as different values X con take. Is there a way to do this? Thank you very much!

Réponses (0)

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Produits


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by