Figures into subplots
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
kfir
el 28 de Mzo. de 2012
Respondida: Leandro de Oliveira
el 28 de Sept. de 2019
Is there a way to take a figure (*.fig file, or just any open figure) and insert it completely into a subplot? (I think I can do it by copying each handle of the figure, but I'm looking for an easier way.)
0 comentarios
Respuesta aceptada
Daniel Shub
el 28 de Mzo. de 2012
Copying into a subplot would be difficult. Technically subplots are just an axis, but figures can have children that cannot be parented by an axis. A better choice might be to make a gird of uipanels. Any object that can be a child of a figure, can also be parented by a uipanel. You can then use the findobj and copyobj functions to copy your figure to a uipanel. Note that a uipanel grid will not behave identically to axes made with subplot.
0 comentarios
Más respuestas (1)
Leandro de Oliveira
el 28 de Sept. de 2019
Try something like this (the for loop):
clc; clear all; close all;
%-------------------------------------------------------------------------%
s = tf('s');
%-------------------------------------------------------------------------%
G = (s+40)/((s^2)+(1.2*s)+4);
%-------------------------------------------------------------------------%
lw = 2;
for i = 1:2
subplot(2,1,i)
if i == 1
h = figure(1);
[mag, fase, w] = bode(G);
hObj = semilogx(w, 20*log10(squeeze(mag)), 'linewidth', lw);
[max_val, index] = max(mag);
cursorMode = datacursormode(h);
hDatatip = cursorMode.createDatatip(hObj);
pos = [w(index) 20*log10(mag(index))];
set(get(hDatatip, 'DataCursor'), 'DataIndex', index, 'TargetPoint', pos);
set(hDatatip, 'Position', pos);
updateDataCursors(cursorMode);
xlabel('Frequência [rad/s]')
ylabel('Magnitude [dB]')
grid on;
end
if i == 2
h = figure(1);
semilogx(w, squeeze(fase), 'linewidth', lw);
xlabel('Frequência [rad/s]')
ylabel('Fase [graus]')
grid on;
end
end
0 comentarios
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!