What is the Fastest way to write the following algorithm

조회 수: 1 (최근 30일)
Jab
Jab 2016년 8월 7일
댓글: Walter Roberson 2016년 8월 8일
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
Azzi Abdelmalek
Azzi Abdelmalek 2016년 8월 7일
You mean the result is 256x256x50
Jab
Jab 2016년 8월 7일
if all the 3rd dimension has the 10 exactly the result will be 256*256*50 otherwise it varies

댓글을 달려면 로그인하십시오.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 8월 7일
편집: Azzi Abdelmalek 2016년 8월 7일
A=cell(1,5)
A=cellfun(@(x) randi(10,256,256,10),A,'un',0) % ---Example----
B=cat(3,A{:});
  댓글 수: 2
Jab
Jab 2016년 8월 7일
Could you please explain this code? Thank you so much
Walter Roberson
Walter Roberson 2016년 8월 8일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Event Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by