Info

此问题已关闭。 请重新打开它进行编辑或回答。

Converting every cell of a cell array into arrays?

1 次查看(过去 30 天)
Hello,
I have a 5x13 cell array DIST that every cell contains some values (every cell have different size).
I need to calculate some statistical moments for every cell of this array.
Here you can see my code.
for i = 1:nlat
for j = 1:nlon
CELL = [DIST{i,j}]; % TREAT EVERY SINGLE CELL AS AN INDIVIDUAL ARRAY
LD(i,j) = exp(MDIST(i,j)+0.5*(SDIST(i,j).^2)); % CALCULATING LOGARITMIC PDF
GD(i,j) = (1./(SDIST(i,j)*2*pi))*exp(-0.5*((DIST{i,j}-MDIST(i,j))./SDIST(i,j)).^2); % CALCULATING GAUSSIAN PDF
end
end
But I end up with this error message:
Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-0.
Error in all_velocities4 (line 54)
GD(i,j) = (1./(SDIST(i,j)*2*pi))*exp(-0.5*((DIST{i,j}-MDIST(i,j))./SDIST(i,j)).^2); % CALCULATING GAUSSIAN PDF
  1 个评论
Stephen23
Stephen23 2020-2-3
You could preallocate the LHS as a cell array and allocate to that. But possibly the empty RHS indicates a problem in your code which should be fixed.

回答(0 个)

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by