Skip to content

Commit

Permalink
arInit can now only modify the ar struct
Browse files Browse the repository at this point in the history
Wrapping the main code of arInit in a function.

This fixes a bug when calling arInit in a loop (arInit no longer overwrites index "i" and other variuables).
  • Loading branch information
niklasneubrand committed May 13, 2024
1 parent 1a320e6 commit 3b48edb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion arFramework3/arInit.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
%
% See also arLoadModel, arLoadData, arReset

global ar
arInitMain;


function arInitMain()

ar_path = fileparts(which('arInit.m'));
if(exist('arCheck','file') == 0)
addpath([ar_path '/Subfunctions'])
Expand Down Expand Up @@ -47,7 +53,6 @@

ar.checksum = [];
ar.info.ar_path = ar_path;
clear ar_path;

% check for updates on github
arCheckVersion;
Expand Down Expand Up @@ -85,3 +90,5 @@
ar.info = orderfields(ar.info);
ar.config = orderfields(ar.config);
ar.ppl = orderfields(ar.ppl);

end

0 comments on commit 3b48edb

Please sign in to comment.