📄 converttoclass.m
字号:
% % converte input arguent 'var' to class specified in 'type'.
% % conversion should be possible by MATLAB conversion functions.
% % Following conversion types are allowed
% % int8
% % uint8
% % int16
% % uint16
% % int32
% % uint32
% % int64
% % uint64
% % single
% % double
function var=converttoclass(var,type)
if (strcmp(type,'int8'))
var=int8(var);
elseif(strcmp(type,'uint8'))
var=uint8(var);
elseif(strcmp(type,'int16'))
var=int16(var);
elseif(strcmp(type,'uint16'))
var=uint16(var);
elseif(strcmp(type,'int32'))
var=int32(var);
elseif(strcmp(type,'uint32'))
var=uint32(var);
elseif(strcmp(type,'int64'))
var=int64(var);
elseif(strcmp(type,'uint64'))
var=uint64(var);
elseif(strcmp(type,'single'))
var=single(var);
elseif(strcmp(type,'double'))
var=double(var);
else
disp('this type is not allowed or supported');
end
% % -------------------------------------------------------------------------
% % This program or any other program(s) supplied with it does not provide any
% % warranty direct or implied. This program is free to use/share for
% % non-commercial purpose only, for any other usage contact with author.
% % Kindly reference author.
% % Thanking you.
% % @ Copyright M Khan
% % Email: mak2000sw@yahoo.com
% % mak2000@GameBox.net
% % http://www.geocities.com/mak2000sw
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -