MATLAB Answers

How to convert unconsistan cell array into 3d matrix?

9 views (last 30 days)
I have cell array of daily temperature data of 18 years including leap year i.e 18*1 and each cell consist on 720*360*366/365 (normal year 365 and leap year 366).
I have found examples example 1 to cell array conversion in to matrix but these exmaples did not define unconsistance length of cells (different length).
I tried below codes but did not workd for me. Thank you in advacne for any help
test = cell2mat(cellfun(@transpose,data,'UniformOutput',0));
test = cell2mat(permute(cellfun(@cell2mat,data,'uni',0),[720,360,18]));

  1 Comment

Sign in to comment.

Accepted Answer

madhan ravi
madhan ravi on 7 Dec 2018


Shakir Hussain
Shakir Hussain on 7 Dec 2018
Direct reshape, permute, cell2mat is not working fo unconsistan dimension of mtrix
(error Dimensions of matrices being concatenated are not consistent.)
Shakir Hussain
Shakir Hussain on 7 Dec 2018
I done it by dealing indiviual cell separately by simple cell2mat

Sign in to comment.

More Answers (0)

Sign in to answer this question.




Translated by