Info
この質問は閉じられています。 編集または回答するには再度開いてください。
how to find data?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi
please have a look on attached file
I can see the value 2.9377e+03 at index 5414
but the following code does not return anything
please tell me what is wrong, I need to extract all the Ys where Z is 29377
aspdepth=Y(Z==29377);
[aspdepth_sorted,aspdepth_order]=sort(aspdepth);
and I will be grateful and appreciate any fast help
Thank YOU
0 件のコメント
回答 (2 件)
Raj
2019 年 7 月 3 日
編集済み: Raj
2019 年 7 月 3 日
First of all 2.9377e+03=2937.7 and not 29377 as you are looking for. So relook into that.
Secondly, i think its just accuracy error. To check this run this:
load('Y.mat')
load('Z.mat')
Z(5414)
aspdepth=Y(Z==ans);
[aspdepth_sorted,aspdepth_order]=sort(aspdepth);
You need to change the data format to get correct result.
2 件のコメント
Raj
2019 年 7 月 3 日
Hello,
1) Since you are looking for "equal or very close" you need to define a tolerance here. How much 'very close' is good enough for your case? Then instead of using '==' you can use a conditional statement something like this
load('Z.mat')
load('Y.mat')
survayline = 12*tand(60);
tolerance_value=10e-3; % Define your tolerance
jj=1;
for ii=1:length(Z)
if abs(Z(ii)-survayline)<tolerance_value
aspdepth(jj)=Y(ii);
jj=jj+1;
end
end
[aspdepth_sorted,aspdepth_order]=sort(aspdepth);
2)
survayline = 12*tand(60)
gives output as survayline = 20.7846. This value is no where close to any values in the Z mat file that you have shared. If the Y and Z mat files that you had shared earlier are also example files, please use correct files or define a large tolerance.
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!