Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Converting every cell of a cell array into arrays?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Stephen23
le 3 Fév 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.
Réponses (0)
Cette question est clôturée.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!