How can I convert every cell of cell array into individual arrays?
2 ビュー (過去 30 日間)
古いコメントを表示
Hello, I have a 5 x 13 cell array and I have to calculate some values (gaussian probability density function and logaritmic distribution pdf) for every cell of it. Here is my code;
for i = 1:nlat
for j = 1:nlon
CELL = cell2mat(DIST([i,j])); % HERE I TRIED TO TREAT EVERY SINGLE CELL AS AN INDIVIDUAL ARRAY
PDF(i,j) = (1./(SDIST(i,j)*2*pi))*exp(-0.5*((CELL(i,j)-MDIST(i,j))./SDIST(i,j)).^2); % CALCULATING GAUSSIAN PDF
LD(i,j) = exp(MDIST(i,j)+0.5*(SDIST(i,j).^2)); % CALCULATING LOGARITMIC PDF
end
end
But I end up with this error mesage;
Index in position 2 exceeds array bounds (must not exceed 1).
Error in all_velocities4 (line 50)
PDF(i,j) = (1./(SDIST(i,j)*2*pi))*exp(-0.5*((CELL(i,j)-MDIST(i,j))./SDIST(i,j)).^2)
0 件のコメント
回答 (1 件)
Walter Roberson
2020 年 1 月 31 日
for i = 1:nlat
for j = 1:nlon
CELL = DIST{i,j} ; % HERE I TRIED TO TREAT EVERY SINGLE CELL AS AN INDIVIDUAL ARRAY
PDF(i,j) = (1./(SDIST(i,j)*2*pi))*exp(-0.5*((CELL(i,j)-MDIST(i,j))./SDIST(i,j)).^2); % CALCULATING GAUSSIAN PDF
LD(i,j) = exp(MDIST(i,j)+0.5*(SDIST(i,j).^2)); % CALCULATING LOGARITMIC PDF
end
end
1 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!