Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Converting every cell of a cell array into arrays?

1 visualización (últimos 30 días)
Sevil Cansu Yildirim
Sevil Cansu Yildirim el 3 de Feb. de 2020
Cerrada: Stephen23 el 4 de Feb. de 2020
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 comentario
Stephen23
Stephen23 el 3 de Feb. de 2020
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.

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by