using relational operators on array and element
古いコメントを表示
Hy,
I'm trying to figure out a way to sort my experiment data. I have a list with values which I want to look at but first I need to delte the ones that don't fit my criteria. For this case I developed the following code:
%tolerance
x=1
%values
T1=5:-5:-15;
%values2
T2=30:5:55;
%values3
f=30:5:120;
%dimension
d=size(meassure);
d=d(1);
%applying tolerance to values I want to extract
var1=T1-x;
var2=T1+x;
%loop to check for criteria
for i=1:d
if T(i,6)>=var1 & T(i,6)<=var2;
else T(i,6)=NaN;
My problem now is, because var1 and var2 are arrays it puts NaN to every value. Even though one of the values fits the if.... criteria.
I hope someone can help me and I explained my problem well enough
3 件のコメント
Stephen23
2019 年 10 月 9 日
This looks like you are trying to write Python code:
for i=1:d
if T(i,6)>=var1 & T(i,6)<=var2;
else T(i,6)=NaN;
If you want to use MATLAB, then you will need to learn MATLAB code syntax.
David Weise
2019 年 10 月 9 日
MATLAB is not very much like C.
The best way to learn basic MATLAB concepts is by working through the introdutory tutorials:
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!