How to display different figures per radio button
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a radiobutton group with 2 buttons : Basic and advanced i want if they pick the basic button i want it to only show the pie graph and if they pick advance i want to show the subplot if different data. Note : Im working in Appdesigner and matlab2019a... pardont my bad grammar (any help is asppreciated)
subplot(3,1,1 ,'replace')
plot(t(m), signal(m), 'b-');
grid on;
title('X', 'FontSize', fontSize);
xlabel('time (s)');
ylabel('x axis accleration ');
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
drawnow;
% Find the envelope by taking a moving max operation, imdilate.
windowWidth = 1501; % Or whateve5 spans a few small peaks.
topEnvelope = imdilate(signal(m), true(windowWidth, 1)); % Or use movmax()
% Find the bottom of the envelope by taking a moving min operation, imerode.
bottomEnvelope = imerode(signal(m), true(windowWidth, 1)); % Or use movmin()
% Plot it.
hold on;
plot(t(m), topEnvelope, 'r-', 'LineWidth', 2);
plot(t(m), bottomEnvelope, 'r-', 'LineWidth', 2);
legend('Data', 'Envelope');
% Save the x axis length so we can apply it to the edit plot
% so they are displayed on the same time frame
% So we can see how it got shorter.
xl = xlim();
% Find the quiet parts.
% Find where upper and lower envelopes are not close together.
envelopeWidth = topEnvelope - bottomEnvelope;
running = envelopeWidth < 25; % Or whatever value you want.
walking = envelopeWidth > 10 & envelopeWidth < 22;
rest = envelopeWidth < 1.5 & envelopeWidth < 1.5 ;
else
figure(4)
rest = rest(rest>0.99)
walking = walking (walking>0.99)
running = running(running<0.99)
actRun = numel(running);
actWalk = numel(walking);
actRest = numel(rest);
pieACT = [actRun actRest actWalk];
labels = {'Run','Rest','Walk'};
pie(pieACT,labels);
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Graphics Performance dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!