简体   繁体   English

我有 2 个数据向量。 如何从一个向量中绘制另一个向量中的某些特定值的数据?

[英]I have 2 vectors of data. How can I plot data from one vector for some specific values from the other vector?

For example, if I have the 2 vectors in Matlab:例如,如果我在 Matlab 中有 2 个向量:

WindSpeed = 1:10; 
PlumeDepth = 6:15; 

I want to plot (or to make a histogram) the whole PlumeDepth vector for WindSpeed = 5 , WindSpeed = 6 , and WindSpeed = 8 separately.我想PlumeDepthWindSpeed = 5WindSpeed = 6WindSpeed = 8绘制(或制作直方图)整个PlumeDepth向量。 Does anyone have any idea?有谁有想法吗? I tried some for and if loops, but it didn't work.我尝试了一些 for 和 if 循环,但没有奏效。 Thanks!谢谢!

I guess this is what you are looking for:我想这就是你要找的:

WindSpeed = [12.3025 11.2528 12.5205 12.1426 11.8742 12.3042 11.5884 11.8757 10.9501 12.2123]
vector = [9,10]     % 10 for 12.2123 and 9 for 10.9501
for ii = vector
    plot(WindSpeed(ii),OlumeDepth);hold on
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM