how can jump and go to line
8 ビュー (過去 30 日間)
古いコメントを表示
suppose i create array and the i enter the no.this no will be checked in the first column of the array and then send other data from second and third column which is corresponding to the no.
in_zone=nonzeros(zone);
Y1=[X1(in_zone,:)]; % Y1 will contain coordinates value X and Y every in_zone
XY=horzcat(inzone,Y1) %XY will merge in_zone and Y1 value
N=input('enter the number :');
N1=find(XY(:,1)==N) %find the value from XY first column
N2=XY(N1,[2,3]) %this will show corresponding value of N1
X6=N2(1);
Y6=N2(2);
now i wish to create jump statement or alternative if no N is not found in XY first column then it will jump again to N.. thanks in advance
0 件のコメント
採用された回答
Michael Haderlein
2015 年 4 月 20 日
There is no jump keyword in Matlab. You can just check like
N=input('enter the number :');
N1=find(XY(:,1)==N); %find the value from XY first column
if isempty(N1)
errordlg('Value does not exist!')
else
N2=XY(N1,[2,3]); %this will show corresponding value of N1
X6=N2(1);
Y6=N2(2);
end
Or, if you want to insist on a correct value:
N1=[];
while isempty(N1)
N=input('enter the number :');
N1=find(XY(:,1)==N); %find the value from XY first column
end
N2=XY(N1,[2,3]) %this will show corresponding value of N1
X6=N2(1);
Y6=N2(2);
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で GPU Computing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!