MATLAB: Is there any way to create array of arrays or matrix of matrices arrayImage Processing ToolboxMATLABmatrix array i want to create array of arrays or matrix of matrices? or create arrays automatically in{ for – loop} then combine them in one array . Best Answer Arrays can contain all types of Matlab variables as elements, but no arrays.A "matrix of matrices" can be seen as 4D array:a = zeros(2, 2, 3, 4);a(:, :, 1, 1) = rand(2, 2);etc.Or with a loop:for i1 = 1:3 for i2 = 1:4 a(:, :, i1, i2) = rand(2, 2); endend Related SolutionsMATLAB: Combine a cell array of cell arrays to a single cell array NewCellArray = vertcat( ExistingCellArray{:} ); MATLAB: Combining cell arrays with empty doubles % slightly more complex example data:a = {[],1;[],[]};b = {[],[];2,[]};c = {[],[];[],NaN};%tmp = cat(3,a,b,c);[~,idp] = sort(cellfun('isempty',tmp),3);sz = size(tmp);[idr,idc] = ndgrid(1:sz(1),1:sz(2));idx = sub2ind(sz,idr,idc,idp(:,:,1));out = tmp(idx)out = 2x2 cell array {0×0 double} {[ 1]} {[ 2]} {[NaN]} Related QuestionTake specific elements from each cell of a cell arrayHow to concatenate the cell array that contain these tableHow to convert cell to arrayCounting elements of a cellHow to make a column of elements in a cell array be empty cell elements?How to combine two arrays
Best Answer