Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gui/gui_place_sources_detectors.m
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ function figure1_WindowButtonDownFcn(hObject, eventdata, handles)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if handles.dimension == 3
% Use bundled SELECT3D implementation for modern MATLAB versions
p = select3d;
if ~isempty(p)
if handles.sourceflag == 1
Expand Down
29 changes: 15 additions & 14 deletions toolbox/mysave.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,30 @@ function mysave(fn,data)
% mysave(fn,data)
%
% save function that will work with matlab compiler
%
%
% fn is the filename to be saved
% data is the variable to be saved


dlim = '\t';
data = data';
[nrow,ncol]=size(data);
fid = OpenFile(fn,'w');

str = ['fprintf(fid, ', '''', '%g'];
if nrow>1
str1 = [];
for i = 2: nrow
str1 = [str1, dlim, '%g'];
end
end
if exist('str1', 'var')
str = [str, str1, '\n', '''', ',data);'];
% Use %d for integer-valued data (e.g. element indices, region labels)
% to avoid precision loss from %g scientific notation on large integers.
% %g defaults to 6 significant digits, which silently corrupts node
% indices above ~1e6 when saving .elem files, causing invalid
% triangulation errors on mesh reload.
if isequal(data, round(data))
fmt = '%d';
else
str = [str, '\n', '''', ',data);'];
fmt = '%g';
end

eval(str)
fmtstr = fmt;
for i = 2:nrow
fmtstr = [fmtstr, '\t', fmt];
end
fmtstr = [fmtstr, '\n'];

fprintf(fid, fmtstr, data);
fclose(fid);
Loading