0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 function a = fromVals(a, pli)
0018
0019 VERSION = '$Id: fromVals.m,v 1.14 2008/09/04 13:37:14 ingo Exp $';
0020
0021
0022 ii = ao.getInfo('ao', 'From Vals');
0023
0024
0025 ii.setMversion([VERSION '-->' ii.mversion]);
0026
0027
0028 pl = combine(pli, ii.plists);
0029
0030
0031 vals = find(pl, 'vals');
0032 xvals = find(pl, 'xvals');
0033 yvals = find(pl, 'yvals');
0034 N = find(pl, 'N');
0035
0036
0037 if isempty(N)
0038 N = 1;
0039 end
0040
0041
0042
0043
0044 if ~isempty(xvals) && ~isempty(yvals)
0045 if ischar(xvals)
0046 try
0047 xvals = eval(xvals);
0048 catch
0049 error('Could not convert char array to numeric array.');
0050 end
0051 end
0052 if ischar(yvals)
0053 try
0054 yvals = eval(yvals);
0055 catch
0056 error('Could not convert char array to numeric array.');
0057 end
0058 end
0059
0060 ts = tsdata(xvals, yvals);
0061
0062
0063 elseif ~isempty(vals)
0064 if ischar(vals)
0065 try
0066 vals = eval(vals);
0067 catch
0068 error('Could not convert char array to numeric array.');
0069 end
0070 end
0071
0072 ts = cdata(repmat(vals, 1, N));
0073
0074 else
0075 error('### Unknown constructor');
0076 end
0077
0078
0079 a.data = ts;
0080
0081 a.addHistory(ii, pl, [], []);
0082
0083 end
0084