How do I export p, t, u, and c back to the workspace using the command line in the PDE Toolbox?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am using the PDE Toolbox and would like to use the PDESMESH function. I would like to export mesh and edge variables from the workspace to the command line. I would like to know if there is a way to export the parameters of PDE Tool back to the workspace using the command line instead of the GUI.
Respuesta aceptada
MathWorks Support Team
el 13 de Nov. de 2012
Here is a function that will export the parameters p, t, u, c, a, f, d, b, and g back to the workspace using the command line instead of the GUI:
For MATLAB 8.0 (R2012b) and earlier releases you can use the following two commands to extract the data to MATLAB Workspace when PDETOOL is active.
pde_fig=findobj(allchild(0),'flat','Tag','PDETool')
u = get(findobj(pde_fig,'Tag','PDEPlotMenu'),'UserData');
MATLAB 5.x and above compatible:
============================
function [p,e,t,u,l,c,a,f,d,b,g] = getpetuc
%GETPETUC Get p,e,t,u, and c.
pde_fig=findobj(allchild(0),'flat','Tag','PDETool');
if isempty(pde_fig)
error('PDE Toolbox GUI not active.')
end
u = get(findobj(pde_fig,'Tag','PDEPlotMenu'),'UserData');
l =get(findobj(pde_fig,'Tag','winmenu'),'UserData');
h=findobj(get(pde_fig,'Children'),'flat','Tag','PDEMeshMenu');
hp=findobj(get(h,'Children'),'flat','Tag','PDEInitMesh');
he=findobj(get(h,'Children'),'flat','Tag','PDERefine');
ht=findobj(get(h,'Children'),'flat','Tag','PDEMeshParam');
p=get(hp,'UserData');
e=get(he,'UserData');
t=get(ht,'UserData');
params=get(findobj(get(pde_fig,'Children'),'flat','Tag','PDEPDEMenu'),...
'UserData');
ns=getuprop(pde_fig,'ncafd');
nc=ns(1); na=ns(2); nf=ns(3); nd=ns(4);
idxstart = 1;
idxstop = nc;
c=params(idxstart:idxstop,:);
idxstart = idxstart+nc;
idxstop = idxstop + na;
a=params(idxstart:idxstop,:);
idxstart = idxstart+nc;
idxstop = idxstop + nf;
f=params(idxstart:idxstop, :);
idxstart = idxstart+nf;
idxstop = idxstop + nd;
d=params(idxstart:idxstop,:);
hbound = findobj(get(pde_fig,'Children'),'flat','Tag','PDEBoundMenu');
g = get(hbound, 'userdata');
hb_cld = get(hbound, 'children');
b = get(hb_cld(7), 'userdata');
MATLAB 4.2c compatible: (This version only exports p, e, t, u and c)
=====================
function [p,e,t,u,c] = getpetuc
%GETPETUC Get p,e,t,u, and c.
pde_fig = findobj(get(0,'Children'),'flat','Tag','PDETool');
if isempty(pde_fig)
error('PDE Toolbox GUI not active.')
end
u = get(findobj(pde_fig,'Tag','PDEPlotMenu'),'UserData');
h=findobj(get(pde_fig,'Children'),'flat','Tag','PDEMeshMenu');
hp=findobj(get(h,'Children'),'flat','Tag','PDEInitMesh');
he=findobj(get(h,'Children'),'flat','Tag','PDERefine');
ht=findobj(get(h,'Children'),'flat','Tag','PDEMeshParam');
p=get(hp,'UserData');
e=get(he,'UserData');
t=get(ht,'UserData');
params=get(findobj(get(pde_fig,'Children'),'flat','Tag','PDEPDEMenu'),...
'UserData');
ns=getuprop(pde_fig,'ncafd');
nc=ns(1); na=ns(2); nf=ns(3); nd=ns(4);
c=params(1:nc,:);
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Boundary Conditions en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!