Unable to perform assignment because the left and right sides have a different number of elements

2 visualizaciones (últimos 30 días)
When there are no values ​​less than 100 in my matrix, this error appears
for i=1:length(NpingZ)
x=find(Mdata(1:VecA(i),i)<100,1,'last')';
Data(i)=x;
end
Is there a way to fix this error?
I will be glad to any advice

Respuesta aceptada

Jan
Jan el 16 de Mzo. de 2022
Editada: Jan el 16 de Mzo. de 2022
Data = nan(1, length(NpingZ)); % Pre-allocate and default value
for i=1:length(NpingZ)
x = find(Mdata(1:VecA(i), i) < 100, 1, 'last')';
if ~isempty(x)
Data(i) = x;
end
end

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by