フィルターのクリア

Cropping xyz data in MATLAB

3 ビュー (過去 30 日間)
Charlotte Findlay
Charlotte Findlay 2018 年 5 月 4 日
コメント済み: Charlotte Findlay 2018 年 5 月 9 日
I am trying to crop an xyz data set (see figure attached) in MATLAB.
The file is too large to convert into a .txt file first and I was wondering if it is possible to do this in MATLAB?
I am looking to retain all xyz data from 55 to 60 degrees latitude (Y) and -4 to -8 degrees longitude (X).
Any help would be much appreciated.

採用された回答

Wick
Wick 2018 年 5 月 4 日
You're trying to extract the data from the image file?
imread will work find for this purpose. It will return an mxnx3 variable where each page represents the red, green, and blue values for each pixel respectively.
Or do you already have the data in MATLAB and you only want to take a small chunk of it? In that case, it would help to know the shape of the data. But I'll assume for the moment that you've got two vectors, LAT, and LON that represent the ranges of latitude and longitude and a 2D variable BATH. Let's assume LAT is a column vector, and LON is a row vector. BATH should be [length(LAT) length(LON)] in size.
LAT_index = LAT >= 55 & LAT <= 60;
LON_index = LON >= -8 & LON <= -4;
LAT_subset = LAT(LAT_index);
LON_subset = LON(LON_index);
BATH_subset = BATH(LAT_index,LON_index);
  1 件のコメント
Charlotte Findlay
Charlotte Findlay 2018 年 5 月 9 日
Thanks Chad the code you supplied worked!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by