Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[838d7e]: blockproc / blockpanelget.m Maximize Restore History

Download this file

blockpanelget.m    64 lines (54 with data), 1.7 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
function [par,varargout] = blockpanelget(p,varargin)
%BLOCKPANELGET Get parameters from GUI
% Usage: [par,...] = blockpanelget(p,spar,...)
%
% Input parameters:
% p : JAVA object
% spar : String. Name of the parameter.
%
% Output parameters:
% par : Single value or vector of parameters.
%
% `par = blockpanelget(p,'spar')` gets a current value of the parameter
% `'spar'` from the GUI specified in `p`.
% `par = blockpanelget(p,'spar1','spar2','spar3')` gets current values
% of the parameters `'spar1'`, `'spar2'` and `'spar3'` from the GUI and
% stores them in a vector `p`.
% `[par1,par2,par3] = blockpanelget(p,'spar1','spar2','spar3')` gets
% current values of the parameters `'spar1'`, `'spar2'` and `'spar3'`
% from the GUI and stores them in the separate variables `par1`,`par2`
% and `par3`.
%
nout = nargout();
if nargin<1
error('%s: Too few input arguments.',upper(mfilename));
end
if nout~=1 && nargin==1
error(['%s: Ambiguous output. When no parameter is explicitly defined,',...
' the function cannot return more tha one output parameter.'],mfilename);
end
if nargin>1
if nout~=1 && nout ~= numel(varargin)
error('%s: Number of inputs does not match with number of outputs.',upper(mfilename));
end
res = javaMethod('getParams',p,varargin);
if nout == 1
if numel(res)==1
par = res(1);
else
par = res;
end
else
par = res(1);
varargout = num2cell(res(2:end));
end
else
par = javaMethod('getParams',p);
if isoctave
parTmp = par;
par = zeros(numel(parTmp),1);
for ii=1:numel(parTmp)
par(ii) = parTmp(ii);
end
end
end