From 3b48edb2b4399742f1e5a64f95a24268aa6ed792 Mon Sep 17 00:00:00 2001 From: Niklas Neubrand <38315848+niklasneubrand@users.noreply.github.com> Date: Mon, 13 May 2024 12:34:12 +0200 Subject: [PATCH] arInit can now only modify the ar struct 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). --- arFramework3/arInit.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arFramework3/arInit.m b/arFramework3/arInit.m index e564721d..e8e7e3b2 100755 --- a/arFramework3/arInit.m +++ b/arFramework3/arInit.m @@ -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']) @@ -47,7 +53,6 @@ ar.checksum = []; ar.info.ar_path = ar_path; -clear ar_path; % check for updates on github arCheckVersion; @@ -85,3 +90,5 @@ ar.info = orderfields(ar.info); ar.config = orderfields(ar.config); ar.ppl = orderfields(ar.ppl); + +end