How can i delete zeros of a Simulation Output?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have a list of values coming from a Simulink model.

I want to ignore the rows that are aproximately 0. I tried with the following code, but the problem is that i keep getting the same output (with 0 instead of NaN). What should I do?
for i=1:1:length(SimOut.System1_UPF_IQ.signals.values(:,1))
if (abs(SimOut.System1_UPF_IQ.signals.values(i,3)) <= 1E-5)
SimOut.System1_UPF_IQ.signals.values(i,2) = nan; SimOut.System1_UPF_IQ.signals.values(i,3) = nan;
else
end
end
0 comentarios
Respuestas (1)
Rebeka
el 18 de Jul. de 2022
a=[1 0 9 7; 3 4 5 6; 0 5 0 0; 2 3 4 5; 1 1 1 1];
x=size(a);
m=x(1);
n=x(2);
for i=1:m
for j=1:n
if a(i,j)==0
a(i,:)=[];
b=size(a);
m=b(1);
n=b(2);
else
return
end
end
end
ans=a;
disp(ans)
You can try this one. Though I think there would be more concise way to do this
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!