How can I assign an empty value to a variable without getting the error "Unable to perform assignment because the left and right sides have a different number of elements."
Mostrar comentarios más antiguos
MATLAB treats empty values as an empty vector. So, how can I avoid the afforementioned error in this case:
f = zeros(1,50);
for kk = 1: 50
[~, maxidx] = max(Mavg(:,:,kk));
f(kk) = find((Mavg(:,:,kk) <= ratio * N) & (maxidx <= 1:length(Mavg(:,:,kk))), 1 );
if isempty(f(kk))
f(kk) = 51;
end
end
1 comentario
Waseem AL Aqqad
el 10 de Dic. de 2021
Editada: Waseem AL Aqqad
el 10 de Dic. de 2021
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 10 de Dic. de 2021
You can't do that.
N = 50;
f = zeros(1,N);
for kk = 1: N
[~, maxidx] = max(Mavg(:,:,kk));
fkk = find(SOMETHING_NOT_CLEAR_WHAT);
if isempty(fkk)
fkk = N+1;
end
f(kk) = fkk;
end
1 comentario
Waseem AL Aqqad
el 10 de Dic. de 2021
Categorías
Más información sobre Fixed-Point Math Functions en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!