[Simnibs-discuss] Scripting simulation with Matlab - SimNIBS 4
Oula Puonti
oulap at drcmr.dk
Mon Jan 23 15:00:43 CET 2023
Hi Peyman,
If the GUI works and matlab does not, it might have something to do
with the issue here:
https://github.com/simnibs/simnibs/issues/106
namely that the system call in matlab does not see the correct
libraries for some reason. You can try to run a linker on the
create_mesh .so and see which libraries it needs and then try to
preload those. I don't have a good solution to this issue at the
moment.
Could you also try if the script works if you run it in python? I'm
guessing it will, as you said that the GUI works.
Best,
Oula
On Sun, 2023-01-22 at 15:38 +0330, Peyman Ghobadi wrote:
> Dear SimNIBS,
>
> I recently used SimNIBS 4. I have a question about scripting
> simulation with Matlab. The GUI is working fine in SimNIBS 4. But
> when I run my script in Matlab I get the following error:
>
> %% General information
>
> S = sim_struct('SESSION');
> S.subpath = 'm2m_sub01'; % subject folder
> S.pathfem = 'tdcs_simu'; % Folder for the simulation output
> S.map_to_surf = true;
>
> %% Define tDCS simulation
> S.poslist{1} = sim_struct('TDCSLIST');
> S.poslist{1}.currents = [0.002, -0.002]; % Current flow though each
> channel (A)
>
> %First Electrode
> S.poslist{1}.electrode(1).channelnr = 1; % Connect the electrode to
> the first channel
> S.poslist{1}.electrode(1).centre = 'F4'; % Place it over F4
> S.poslist{1}.electrode(1).shape = 'rect'; %Rectangular electrode
> S.poslist{1}.electrode(1).dimensions = [50, 70]; % Dimension in mm
> S.poslist{1}.electrode(1).thickness = 4; % 4 mm thickness
>
> %Second Electrode
> S.poslist{1}.electrode(2).channelnr = 2;
> S.poslist{1}.electrode(2).centre = 'F3';
> S.poslist{1}.electrode(2).shape = 'rect';
> S.poslist{1}.electrode(2).dimensions = [50, 70];
> S.poslist{1}.electrode(2).thickness = 4;
>
> %% Run Simulation
> run_simnibs(S);
>
>
> Error using run_simnibs (line 30)
> There was an error running SimNIBS:
> Traceback (most recent call last):
> File "/home/incas/SimNIBS-4.0/simnibs_env/lib/python3.9/site-
> packages/simnibs/cli/run_simnibs.py", line 7, in <module>
> from simnibs import run_simnibs
> File "/home/incas/SimNIBS-4.0/simnibs_env/lib/python3.9/site-
> packages/simnibs/__init__.py", line 21, in <module>
> from .mesh_tools import *
> File "/home/incas/SimNIBS-4.0/simnibs_env/lib/python3.9/site-
> packages/simnibs/mesh_tools/__init__.py", line 6, in <module>
> from .mesh_io import *
> File "/home/incas/SimNIBS-4.0/simnibs_env/lib/python3.9/site-
> packages/simnibs/mesh_tools/mesh_io.py", line 49, in <module>
> from . import cgal
> File "/home/incas/SimNIBS-4.0/simnibs_env/lib/python3.9/site-
> packages/simnibs/mesh_tools/cgal/__init__.py", line 1, in <module>
> from .create_mesh_surf import *
> ImportError: /home/incas/SimNIBS-4.0/simnibs_env/lib/python3.9/site-
> packages/simnibs/mesh_tools/cgal/create_mesh_surf.cpython-39-x86_64-
> linux-gnu.so: undefined
> symbol: __gmpq_add
>
>
> Error in tDCS (line 27)
> run_simnibs(S);
>
>
> I look forward to hearing from you.
>
> Best regards,
> Peyman
> _______________________________________________
> Simnibs-discuss mailing list
> Simnibs-discuss at drcmr.dk
> https://mailman.drcmr.dk/mailman/listinfo/simnibs-discuss
More information about the Simnibs-discuss
mailing list