How can i delete zeros of a Simulation Output?
2 ビュー (過去 30 日間)
古いコメントを表示
I have a list of values coming from a Simulink model.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1068960/image.png)
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 件のコメント
回答 (1 件)
Rebeka
2022 年 7 月 18 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Manual Performance Optimization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!