What is the Fastest way to write the following algorithm

1 Ansicht (letzte 30 Tage)
Jab
Jab am 7 Aug. 2016
Kommentiert: Walter Roberson am 8 Aug. 2016
I have a cell array y={1X5} each cell contains 256*256*10(3rd dimension will vary for each cell) 3D vectors. My need is to convert the cell array to matrix of the form 256*256*100. Could anyone please help me to write the fastest simple code. Thanks
  2 Kommentare
Azzi Abdelmalek
Azzi Abdelmalek am 7 Aug. 2016
You mean the result is 256x256x50
Jab
Jab am 7 Aug. 2016
if all the 3rd dimension has the 10 exactly the result will be 256*256*50 otherwise it varies

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 7 Aug. 2016
Bearbeitet: Azzi Abdelmalek am 7 Aug. 2016
A=cell(1,5)
A=cellfun(@(x) randi(10,256,256,10),A,'un',0) % ---Example----
B=cat(3,A{:});
  2 Kommentare
Jab
Jab am 7 Aug. 2016
Could you please explain this code? Thank you so much
Walter Roberson
Walter Roberson am 8 Aug. 2016
The first two lines of it create random data of the proper size, for the sake of illustrating the third line which is the line you need to use on your own cell array.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Event Functions 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!

Translated by