フィルターのクリア

How do I select specific data?

45 ビュー (過去 30 日間)
Charlie Finnie
Charlie Finnie 2016 年 10 月 21 日
回答済み: Sulaymon Eshkabilov 2022 年 8 月 10 日
Hi I am new to Matlab and I'm trying to get my feet on the ground here.
I have 2 columns of data and but I only want to select data in column 2 for a given number of rows which I have defined using
> find(time<5)
where time is the number of the variable in column 1.
This has given me the row numbers for all the data I want, Now I was just wandering how I select the data in column 2 for these row numbers?
Thanks

回答 (4 件)

Mischa Kim
Mischa Kim 2016 年 10 月 21 日
Use
mat(find(time<5),2)

Star Strider
Star Strider 2016 年 10 月 21 日
If your (Nx2) array is called ‘data’:
ExtractedData = data(find(time<5),2);
should work.

Pico Technology
Pico Technology 2016 年 10 月 21 日
Hi Charlie,
You can index a matrix using the row column indices - matrix dimensions are defined as number of rows x number of columns. The following article should help:
If r is the rows i.e.
r = find(time<5)
then you can extract the data from your 2nd column as follows (assuming x is the matrix)
y = x(r, 2);
Hope this helps.

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2022 年 8 月 10 日
A simple solution is:
Select_Data = Data(time<5,2);

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by