how can I link subplots (for brush data)?
how can I link subplots (for brush data)?
this is my code :
colors = {‘r’, ‘g’, ‘b’, ‘c’, ‘m’, ‘y’, ‘k’, [0, 0.5, 0.5], [0.5, 0.5, 0], [0, 0.5, 0], [0.5, 0, 0],[0, 0, 0.5], [0.5, 0.5, 0.5],[0.3010 0.7450 0.9330],[0.4660 0.6740 0.1880],[0.4940 0.1840 0.5560],[0.9290 0.6940 0.1250],[0.8500 0.3250 0.0980],[0.6350, 0.0780, 0.1840],[0 0.4470 0.7410] };
[filename,pathname] = uigetfile(‘*.csv’, ‘Select CSV files’, ‘MultiSelect’, ‘on’);
if isnumeric(filename) % user clicked Cancel
return
end
s=size(filename,2);
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData2=table2array(o(:,2));
fig = figure();
subplot(3,1,1)
p1=plot( cData1,cData2,…
‘Color’, colors{mod(i, numel(colors)) + 1});
hold(‘on’)
end
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData3=table2array(o(:,3));
subplot(3,1,2)
p2=plot( cData1,cData3,…
‘Color’, colors{mod(i, numel(colors)) + 1});
% grid(app.UIAxes2_2,’on’)
hold(‘on’)
end
%%%%%%%%%%%%%%%%%%%%%%%%
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData4=table2array(o(:,4));
subplot(3,1,3)
p3=plot( cData1,cData4,…
‘Color’, colors{mod(i, numel(colors)) + 1});
% grid(app.UIAxes2,’on’)
hold(‘on’)
end
b=brush(fig);
b.ActionPostCallback = {@onBrushAction,p1,p2,p3};
% callback function
function onBrushAction(~, eventdata,p1,p2,p3)
set(p1, ‘BrushData’, eventdata.Axes.Children.BrushData)
set(p2, ‘BrushData’, eventdata.Axes.Children.BrushData)
set(p3, ‘BrushData’, eventdata.Axes.Children.BrushData)
endhow can I link subplots (for brush data)?
this is my code :
colors = {‘r’, ‘g’, ‘b’, ‘c’, ‘m’, ‘y’, ‘k’, [0, 0.5, 0.5], [0.5, 0.5, 0], [0, 0.5, 0], [0.5, 0, 0],[0, 0, 0.5], [0.5, 0.5, 0.5],[0.3010 0.7450 0.9330],[0.4660 0.6740 0.1880],[0.4940 0.1840 0.5560],[0.9290 0.6940 0.1250],[0.8500 0.3250 0.0980],[0.6350, 0.0780, 0.1840],[0 0.4470 0.7410] };
[filename,pathname] = uigetfile(‘*.csv’, ‘Select CSV files’, ‘MultiSelect’, ‘on’);
if isnumeric(filename) % user clicked Cancel
return
end
s=size(filename,2);
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData2=table2array(o(:,2));
fig = figure();
subplot(3,1,1)
p1=plot( cData1,cData2,…
‘Color’, colors{mod(i, numel(colors)) + 1});
hold(‘on’)
end
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData3=table2array(o(:,3));
subplot(3,1,2)
p2=plot( cData1,cData3,…
‘Color’, colors{mod(i, numel(colors)) + 1});
% grid(app.UIAxes2_2,’on’)
hold(‘on’)
end
%%%%%%%%%%%%%%%%%%%%%%%%
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData4=table2array(o(:,4));
subplot(3,1,3)
p3=plot( cData1,cData4,…
‘Color’, colors{mod(i, numel(colors)) + 1});
% grid(app.UIAxes2,’on’)
hold(‘on’)
end
b=brush(fig);
b.ActionPostCallback = {@onBrushAction,p1,p2,p3};
% callback function
function onBrushAction(~, eventdata,p1,p2,p3)
set(p1, ‘BrushData’, eventdata.Axes.Children.BrushData)
set(p2, ‘BrushData’, eventdata.Axes.Children.BrushData)
set(p3, ‘BrushData’, eventdata.Axes.Children.BrushData)
end how can I link subplots (for brush data)?
this is my code :
colors = {‘r’, ‘g’, ‘b’, ‘c’, ‘m’, ‘y’, ‘k’, [0, 0.5, 0.5], [0.5, 0.5, 0], [0, 0.5, 0], [0.5, 0, 0],[0, 0, 0.5], [0.5, 0.5, 0.5],[0.3010 0.7450 0.9330],[0.4660 0.6740 0.1880],[0.4940 0.1840 0.5560],[0.9290 0.6940 0.1250],[0.8500 0.3250 0.0980],[0.6350, 0.0780, 0.1840],[0 0.4470 0.7410] };
[filename,pathname] = uigetfile(‘*.csv’, ‘Select CSV files’, ‘MultiSelect’, ‘on’);
if isnumeric(filename) % user clicked Cancel
return
end
s=size(filename,2);
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData2=table2array(o(:,2));
fig = figure();
subplot(3,1,1)
p1=plot( cData1,cData2,…
‘Color’, colors{mod(i, numel(colors)) + 1});
hold(‘on’)
end
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData3=table2array(o(:,3));
subplot(3,1,2)
p2=plot( cData1,cData3,…
‘Color’, colors{mod(i, numel(colors)) + 1});
% grid(app.UIAxes2_2,’on’)
hold(‘on’)
end
%%%%%%%%%%%%%%%%%%%%%%%%
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData4=table2array(o(:,4));
subplot(3,1,3)
p3=plot( cData1,cData4,…
‘Color’, colors{mod(i, numel(colors)) + 1});
% grid(app.UIAxes2,’on’)
hold(‘on’)
end
b=brush(fig);
b.ActionPostCallback = {@onBrushAction,p1,p2,p3};
% callback function
function onBrushAction(~, eventdata,p1,p2,p3)
set(p1, ‘BrushData’, eventdata.Axes.Children.BrushData)
set(p2, ‘BrushData’, eventdata.Axes.Children.BrushData)
set(p3, ‘BrushData’, eventdata.Axes.Children.BrushData)
end plot, brush, link, data MATLAB Answers — New Questions