Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Get indices for cells in an array that match a value, refer to the other column of data, put these into a new variable

1 回表示 (過去 30 日間)
NiallH
NiallH 2015 年 11 月 17 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have m lots of 2 columns of data, length n, stored in a 2 x n x m array.
[x] = 2 x n x m doubles
I plot each data set on a graph, and allow the user to select the data point from n to plot across the m data sets. e.g. value_store = 520
How would I find the index of the data where value_store matches the data in column 1 of the 2 x n x m array, and use that to refer to the point I wish to plot in each series m?
For p = 1:m
% find which cell is equal to the user-selected value
% refer to the other column of data
% put this data into a new variable
end
plot(y-axis_value_at_selected_data_points,m)
where m is the data sets from the original array
Thanks in advance for the help

回答 (1 件)

the cyclist
the cyclist 2015 年 11 月 17 日
x(:,:,1)==value_store
returns a 2 x n matrix identifying all the locations in the first "slice" (which contains all the "first columns" of your 3-D array) of x that equal value_store.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by