Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Converting every cell of a cell array into arrays?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Stephen23
il 3 Feb 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.
Risposte (0)
Questa domanda è chiusa.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!