Problem using quiver comand

1 回表示 (過去 30 日間)
Jaime  de la Mota
Jaime de la Mota 2017 年 5 月 16 日
編集済み: Cyril GADAL 2017 年 5 月 17 日
I have two 360*180*12 matrices with meteorological data and it's significance; I want to plot the data and use quiver to draw arrows where that dada is significative:
figure
for i=1:12
subplot(4,3,i);imagescnan(loni,lati,squeeze(double(r4_sat(:,:,i)))'),colorbar;
hold on
subplot(4,3,i);quiver(loni,lati,r4_sat_significative, r4_sat_significative ),colorbar;
This is the code I am triying to use; draw one of the matrices and quiver the other on top; this gives me an error. Can someone please tell me how to represent it properly?

回答 (1 件)

Cyril GADAL
Cyril GADAL 2017 年 5 月 16 日
Hello,
Can you give us the error you obtain ? Thus, you should probably write it this way :
figure
for i=1:12
subplot(4,3,i);
imagescnan(loni,lati,squeeze(double(r4_sat(:,:,i)))')
colorbar
hold on
quiver(loni,lati,r4_sat_significative, r4_sat_significative )
end
Don't forget the end at the end for the loop. Also, be carefull with the double use of colorbar, even if there is probably a way to have two colobar, I don't see why you want ... I assume that the colorbar is for the image you want to plot ?
  2 件のコメント
Jaime  de la Mota
Jaime de la Mota 2017 年 5 月 16 日
It seems that it needs all four components to have the same size, but loni is a vector of 360 longitudes, lati is a vector of 180 latitudes and r4_sat_significative is a 360x180x12. It tells me that r4_sat_significative and loni should have the same dimensions.
Cyril GADAL
Cyril GADAL 2017 年 5 月 17 日
編集済み: Cyril GADAL 2017 年 5 月 17 日
I think the error probably comes from the fact you forgot the i in r4_sat_significative :
figure
for i=1:12
subplot(4,3,i);
imagescnan(loni,lati,squeeze(double(r4_sat(:,:,i)))')
colorbar
hold on
quiver(loni,lati,r4_sat_significative(:,:i), r4_sat_significative(:,:,i) )
end
You can keep loni and lati as vectors, it should work.

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

カテゴリ

Help Center および File ExchangeRed についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by