loops and conditional statements in Matlab for data filtration

2 ビュー (過去 30 日間)
okoth ochola
okoth ochola 2023 年 1 月 19 日
回答済み: prasanth s 2023 年 1 月 19 日
Hi Matlab community. Can someone kindly assist with this question. Assuming you have an input matrix A=transpose([1 3 4 2 3 -9 4 -7 8 6 7 -1 2 3 4 6 19 7 12 3 -4 -5 6 7 8 2 3 5 2 3 4 ]), i want to write a script with conditional statements that checks each value if it satifies two conditions (say i<0 && i>0), if the staement is true, the programs passes to the next cell, if false then the value of that cell is set to zero.thus should be done over all cells and finally the output should be amatrix without any values <0 or >10. Thanks in advance. I know this might be done easily via command window but that option is not available for me right now. The professor issists on scripts, please anyone help, may God bless you as do so

採用された回答

prasanth s
prasanth s 2023 年 1 月 19 日
A=[1 3 4 2 3 -9 4 -7 8 6 7 -1 2 3 4 6 19 7 12 3 -4 -5 6 7 8 2 3 5 2 3 4 ]';
A(A<0)=0;
A(A>10)=0;

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by