Merging calculated solution elements cell arrays into a single column cell array

조회 수: 1 (최근 30일)
Dear All,
Please, I have a major issue which I would greatly appreciate some assistance. I have calculated a 3x1x108 cell array solution. Each of the 108 elements is a numeric array with dimensions ranging from val (:,:,1) to val (:,:,108). I would like to merge all the calculated element’s solution into a single 3x1 column array.
Thank you so much for your help.
Val (:,:,1) = 1.0e+04 *
0.000000022979506 - 0.000000036470490i
0.002185443408772 - 0.052463050512697i
2.289129333615808 + 5.029468816352341i
Val (:,:,2) = 1.0e+04 *
-0.000001404857395 + 0.000002447418100i
-0.021924555135876 - 0.020324520317864i
1.557775455827619 + 0.915119490385055i
Val (:,:,3) = 1.0e+04 *
-0.000003885746464 - 0.000002190311736i
-0.534013981410952 - 0.242903162743672i
1.943318570895146 + 2.219598861090568i
Val (:,:,108) = 1.0e+04 *
-0.000000014195745 - 0.000000010788638i
-2.278194863009318 + 0.437249050543058i
1.969494482063662 + 0.559354184163361i

채택된 답변

Mohammad Sami
Mohammad Sami 2021년 6월 24일
You can try using cell2mat to convert the cells into a matrix.
a = num2cell(randi(3,[3 1 108]));
b = cell2mat(a);
b = permute(b,[3 1 2]);
b
b = 108×3
2 2 3 2 1 2 1 1 3 2 1 2 1 3 2 1 1 3 2 1 1 1 2 3 3 3 3 1 3 1
  댓글 수: 1
Mohammed Abdullahi
Mohammed Abdullahi 2021년 6월 25일
The goal is to obtain single 3x1 matrix from 108x1 matrix. what is the most appropriate way to achieve that?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by