Skip to Main Content Skip to Search
Home |   Select Country  Choose Country  |  Contact Us  |  Cart Store 
Create Account | Log In
Products & Services Solutions Academia Support User Community Company
spacer spacer spacer spacer spacer spacer

Technical Solutions

How do I export p, t, u, and c back to the workspace using the command line in the PDE Toolbox?


Date Last Modified: Friday, June 26, 2009
Solution ID:   1-15TMV
Product:   Partial Differential Equation Toolbox
Reported in Release:   R11
Platform:   All Platforms
Operating System:   All OS
 

Subject:

How do I export p, t, u, and c back to the workspace using the command line in the PDE Toolbox?

Problem Description:

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.

Solution:

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:

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,:);

Please provide feedback to help us improve this Solution
Contact support
E-mail this page
Print this page