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 天)
  
       显示 更早的评论
    
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
0 个评论
回答(1 个)
  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.
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!