Extracting selected data from figures

1 回表示 (過去 30 日間)
MatlabUser
MatlabUser 2016 年 3 月 13 日
回答済み: Walter Roberson 2016 年 3 月 14 日
Hi, I have a real-time data plot where the x-limits are changing automatically (due to zoom in/out). What would be a computationally efficient way of extracting data corresponding to the current x-limits on the plot at each instance. I realize that we can use 'get(dataObjs, 'XData')' but this would give me the entire data array and would therefore require further processing to get only desired range data (as specified by the current x-limits). Many thanks.

採用された回答

Walter Roberson
Walter Roberson 2016 年 3 月 14 日
There is no method provided for this purpose. You would need to extract the x and y limits and figure out which points fit within the range.
With the XData not needing to be contiguous, extracting the data correspond to the current x limits would in general require creating a cell array which could end getting populated with as many as length(x) different components. For example,
x = 1 + rand(1,100);
x(2:2:end) = 0;
then with an xlimit that was greater than 0 but less than 2, you could end having to break into segments {x(1), x(3), x(5), ...}

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by