Select specific cells from a cell array and create a seperate vector
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ilias Minas
am 28 Mär. 2020
Kommentiert: the cyclist
am 28 Mär. 2020
Hi everyone,
I have the following cell array
Max_Col_Cell(9,10,15)
I want to isolate every combination of the first two elements (9,10) for all the 15 values of the third element and create new vectors having one column with 15 rows.
For example create a vector having (1,1,:). Another vector having (2,1,:) etc....
I am trying to write a for loop but its not working.
How can i do this?
Ilias
2 Kommentare
Ameer Hamza
am 28 Mär. 2020
Why do you want to create seperate vectors each set of 15 elements. See here why it is a bad ideahttps://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer. Using a matrix is much better solution.
Akzeptierte Antwort
the cyclist
am 28 Mär. 2020
Bearbeitet: the cyclist
am 28 Mär. 2020
Does your cell array have only numeric values in it?
If yes, then
maxVal = max(cell2num(C),[],3)
where C is your cell array.
3 Kommentare
Ameer Hamza
am 28 Mär. 2020
I guess the cyclist wanted to write
maxVal = max(cell2mat(C),[],3)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Structures finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!