My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
getQucsVariable.m
Go to the documentation of this file.
1 % -*- texinfo -*-
2 % @deftypefn {Function File} {[@var{x}] =} getQucsVariable (@var{dataset}, @var{varname})
3 % Load the vector @var{x} from a Qucs dataset @var{dataset} with the variable name @var{varname}.
4 %
5 % Example
6 % @example
7 % [x] = getQucsVariable (data, "out.v")
8 % x =
9 % 1 + 0.5i
10 % 2 + 1.5i
11 % @end example
12 % @end deftypefn
13 
14 % Copyright 2010 (C) 2010 by Eberhard Gamm <eberhard.gamm@gmx.de>
15 % Published under GNU General Public License (GPL V2). No warranty at all.
16 
17 function data = getQucsVariable(dataSet,name)
18 % Get variable from data set
19 
20 data = [];
21 if isempty(dataSet)
22  error('Data set is empty');
23 end
24 for i=1:numel(dataSet)
25  if strcmp(dataSet(i).name,name)
26  data = dataSet(i).data;
28  end
29 end
30 error(['Variable ' name ' not found in data set']);