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

1 Ansicht (letzte 30 Tage)
Federico Manchini
Federico Manchini am 24 Mär. 2019
Kommentiert: Walter Roberson am 24 Mär. 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!

Antworten (0)

Kategorien

Mehr zu Cell Arrays finden Sie in Help Center und File Exchange

Produkte


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by