Brush Tool Only Exports x and y data. Is there a way to export size?

조회 수: 7 (최근 30일)
Kate
Kate 2024년 1월 17일
답변: SAI SRUJAN 2024년 1월 22일
I am trying to save the x, y, and size of scatterpoint from my brushed data (only the x and y data saves). Is there a way to do this? Thank you for the help!
If not is there a way to find in my [1048575x10 double] the tenth column that corresponds to two columns.
Ex:
A B C D E F G H I J
1 2 3 4 5 6 7 8 9 10
6 3 7 9 5 3 2 5 6 7
given a 2 x 2 double:
3 4
4 9
I would get out
10
7
Thank you!
  댓글 수: 1
Kate
Kate 2024년 1월 17일
Is there away to hold a fifth variable in each point of the scatterplot? And also export this?

댓글을 달려면 로그인하십시오.

답변 (1개)

SAI SRUJAN
SAI SRUJAN 2024년 1월 22일
Hi Kate,
I understand that you are working with a 'scatter' plot and have used a 'brush' tool to select certain points within it. The 'brush' tool you're using currently only allows you to save the 'x' and 'y' coordinates of the selected data points, However, you also wish to capture an additional attribute, the size of each point.
Here's an example of the code used to generate the plot:
% Example data
x = [1, 2, 3, 4, 5];
y = [5, 4, 3, 2, 1];
sizes = [10, 20, 30, 40, 50]; % Sizes for scatter points
% Create the scatter plot
s = scatter(x, y, sizes);
brush('on')
To determine the size of each data point selected with the 'brush' tool, please apply the following workaround. After utilizing the 'brush' to highlight the desired scatter points, execute the following command in the command window.
brushedIndices = find(s.BrushData);
This command will create a variable in the workspace that holds the indices of the brushed scatter points. With these indices, you can then extract the corresponding 'x', 'y', and scatter size values for each selected point by indexing into the original data arrays.
For a comprehensive understanding of the 'brush' function in MATLAB, please refer to the following documentation.
I hope this helps!

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by