フィルターのクリア

How can perform "find" in loop?

3 ビュー (過去 30 日間)
MOzhdeh Salimi
MOzhdeh Salimi 2021 年 7 月 25 日
コメント済み: MOzhdeh Salimi 2021 年 7 月 25 日
Hi all
This is my code. I have a problem with my loop. The "find" function doesn't work in my loop and the answer of the loop is 1.
% read image and fit regression line%
VF = imread('Vf.tif');
Tnormal= imread('Tnormmsh.tif');
[i,j]=size(VF);
length=i*j;
X=VF(1:length);
Y=Tnormal(1:length);
Minx=min(X);
Maxx=max(X);
for X=Minx:0.01:Maxx
X1=X;
X2=X1+0.01;
idx=find(X>=X1 & X<X2)
end

採用された回答

Chunru
Chunru 2021 年 7 月 25 日
VF = imread('Vf.tif');
Tnormal= imread('Tnormmsh.tif');
%[i,j]=size(VF);
%length=i*j;
len = numel(VF); % don't use length as variable names
%X=VF(1:length);
X=VF(:);
Y=Tnormal(1:len);
Minx=min(X);
Maxx=max(X);
%for X=Minx:0.01:Maxx
for x0=Minx:0.01:Maxx % X is used above
X1 = x0; %X1=X;
X2 = x0 + 0.01; %X2=X1+0.01;
idx=find(X>=X1 & X<X2)
end
  1 件のコメント
MOzhdeh Salimi
MOzhdeh Salimi 2021 年 7 月 25 日
Thank you so much , It work.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by