Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
In an assignment A(I) = B, the number of elements in B and I must be the same
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Chamira Wickramasinghe
el 11 de Feb. de 2016
Cerrada: MATLAB Answer Bot
el 20 de Ag. de 2021
whenever i execute following code it gives an error "In an assignment A(I) = B, the number of elements in B and I must be the same.". How can i overcome the problem?
for i = 1:3
mr_Ch(i) = (transpose(lab1_EEG(i,:))) - mean(transpose(lab1_EEG(i,1)));
end
0 comentarios
Respuestas (1)
Jan
el 11 de Feb. de 2016
Editada: Jan
el 11 de Feb. de 2016
This is a column vector:
temp1 = transpose(lab1_EEG(i,:)))
This is a scalar:
temp2 = mean(transpose(lab1_EEG(i,1)))
In consequence this is a column vector also:
temp3 = temp1 - temp2
Now you try to assign this vector to a scalar variable:
mr_Ch(i) = temp3
This must fail. What do you want to store in mr_Chi? We cannot guess, what you want to achieve. But perhaps this helps - without a loop:
mr_Chi = bsxfun(@minus, lab1_EEG, mean(lab1_EEG, 1)).';
1 comentario
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!