Something went wrong on our end
-
Cristian Galperti authored
- parameters - wavegens still to come
Cristian Galperti authored- parameters - wavegens still to come
SCDclass_mdsparfixdimvectorint.m 2.29 KiB
classdef SCDclass_mdsparfixdimvectorint < SCDclass_mdspar
% A constant 1D vector integer (matlab cast to int32) MDS+ parameter
% If the number of elements is different w.r.t. the
% property dimension, the size is adjusted by zero
% filling or clipping
properties(Access=private)
dimension
end
methods
function obj=SCDclass_mdsparfixdimvectorint(srctdimodel, destparam, destdimension, varargin)
obj@SCDclass_mdspar();
% Constructor parser customization definitions here
obj=obj.parseconstructorcommon(srctdimodel, destparam, varargin);
% Constructor parser customization results here
obj.classname=mfilename;
obj.dimension=destdimension;
obj.marteclassname='MDSParFixDimVectorInt';
end
function actualizedata(obj, shot)
obj=obj.preactualizecommon(shot);
if ~obj.actualizable, return; end
numelements=numel(obj.value);
if(numelements<obj.dimension)
localgetcommand=sprintf('[%s; zeros(%d,1)]',obj.getcommand, obj.dimension-numelements);
elseif(numelements>obj.dimension)
localgetcommand=sprintf('%s(1:%d)', obj.getcommand, obj.dimension);
else
localgetcommand=obj.getcommand;
end
obj.assignstring=sprintf('%s=%s;',obj.assignvar,localgetcommand);
obj.caststring=sprintf('%s=int32(%s);',obj.assignvar,obj.assignvar);
obj.postactualizecommon(shot);
end
function [obj, value] = getdata(obj,shot)
[obj,value]=obj.getdatacommon(shot);
value=int32(value);
end
function printinfo(obj)
obj.printinfocommon;
fprintf(' Parameter fixed dimension is: %d\n',obj.dimension);
end
function entrystring = genMARTe2entry(obj, shot)
entrystring=obj.genMARTe2entrycommon(shot);
entrystring=[entrystring ' Dim=' num2str(obj.dimension)];
entrystring=[entrystring ' }'];
end
function out = casttomds(obj, in)
out = int32(in);
end
end
end