MatrixBerryCore
createvaluearray.m
Go to the documentation of this file.
1 function valueArray=createvaluearray(className,value,sizeVec)
2 if numel(value)~=1
3  mxberry.core.throwerror('wrongInput',...
4  'only scalar value is expected');
5 end
6 %
7 isHandle=isa(value,'handle');
8 if isHandle||~isa(value,className)
9  value=feval(className,value);
10 end
11 %
12 nElem=prod(sizeVec);
13 if nElem==0
14  valueArray=feval([className,'.empty'],sizeVec);
15  return;
16 end
17 %
18 if isHandle
19  valueArray(nElem)=value;
20  if nElem>1
21  for iElem=1:nElem-1
22  valueArray(iElem)=feval(className,value);
23  end
24  valueArray=reshape(valueArray,sizeVec);
25  end
26 else
27  valueArray=repmat(value,sizeVec);
28 end
function repmat(in inpArray, in varargin)
function createvaluearray(in className, in value, in sizeVec)
CREATEVALUEARRAY is designed for creating arrays of a specified type and size filled with a specified...