-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmp_makeallDouble.m
More file actions
28 lines (25 loc) · 896 Bytes
/
mp_makeallDouble.m
File metadata and controls
28 lines (25 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
% converts all mp objects to double variables
% put variable names as cell strings into mp_dontmakeallDouble if you
% don't want them converted
% e.g. mp_dontmakeallDouble={'C1','C2'};
% if you don't want C1 and C2 converted to doubles
tempVarList=whos;
if exist('default_precision')~=1
default_precision=mp_Defaults(mp(0));
end
for tempLoopVar=1:length(tempVarList)
if strcmp(tempVarList(tempLoopVar).class,'mp')
tempGoon=1;
if exist('mp_dontmakeallDouble')
if any(strcmp(tempVarList(tempLoopVar).name,mp_dontmakeallDouble))
tempGoon=0;
end
end
if tempGoon
if ~strcmp(tempVarList(tempLoopVar).name,'default_precision')
eval([tempVarList(tempLoopVar).name,'=double(',tempVarList(tempLoopVar).name,');']);
end
end
end
end
clear tempVarList tempLoopVar tempGoon