# Empty sim object

**URL:** <https://forum.cadet-web.de/t/empty-sim-object/167>\
**Category:** CADET Troubleshooting\
**Created:** [September 9, 2020, 5:35am UTC](https://forum.cadet-web.de/t/empty-sim-object/167 "2020-09-09T05:35:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![agedwards](https://forum.cadet-web.de/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@agedwards](https://forum.cadet-web.de/u/agedwards)\
**Post date:** [September 9, 2020, 5:35am UTC](https://forum.cadet-web.de/t/empty-sim-object/167/1 "2020-09-09T05:35:32Z")

</div>

Hello all,

I’m having an unusual problem with the Matlab interface. Calling Simulator.create() returns an empty sim object. I am running some simple Lumped Rate Models. The strange thing is that they ran perfectly until recently, with no changes to the core package, so I assume no changes to the MexSimulator(). Any advice?

Thanks,  
Andy

---

<div class="post-metadata">

**Author:** ![s.leweke](https://forum.cadet-web.de/user_avatar/forum.cadet-web.de/s.leweke/32/1323_2.png) [@s.leweke](https://forum.cadet-web.de/u/s.leweke)\
**Post date:** [September 10, 2020, 7:36am UTC](https://forum.cadet-web.de/t/empty-sim-object/167/2 "2020-09-10T07:36:28Z")

</div>

Hi Andy,

if you are getting an empty object/array from `Simulator.create()`, Matlab could not load the mex binary.  
Please run `MexSimulator()` in the Matlab command window. This should print some error messages.

If you have recompiled CADET, also consider the situation of this thread: [Mac OS Installation - #11 by agedwards](https://forum.cadet-web.de/t/mac-os-installation/141/11)

---

<div class="post-metadata">

**Author:** ![agedwards](https://forum.cadet-web.de/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@agedwards](https://forum.cadet-web.de/u/agedwards)\
**Post date:** [September 10, 2020, 5:43pm UTC](https://forum.cadet-web.de/t/empty-sim-object/167/3 "2020-09-10T17:43:08Z")

</div>

Hi Sam,

I have not recompiled, but yes it is not finding the binary for no reason I can understand. The error is as it was on the original compilation (below), but I have confirmed that the libtbb\_preview.dylib is correct and in place.

## Andy

Error:  
Invalid MEX-file  
‘/Users/Andy/Dropbox/RadTran/Models/Chromatography  
models/Advection Diffusion  
model/CADET/cadet/matlab/bin/CadetMex.mexmaci64’:  
dlopen(/Users/Andy/Dropbox/RadTran/Models/Chromatography  
models/Advection Diffusion  
model/CADET/cadet/matlab/bin/CadetMex.mexmaci64, 6): Library not  
loaded: @rpath/libtbb\_preview.dylib  
Referenced from:  
/Users/Andy/Dropbox/RadTran/Models/Chromatography  
models/Advection Diffusion  
model/CADET/cadet/matlab/bin/CadetMex.mexmaci64  
Reason: image not found

Error in MexSimulator (line 137)  
obj.mexHandle = CadetMex(‘create’);

---

<div class="post-metadata">

**Author:** ![s.leweke](https://forum.cadet-web.de/user_avatar/forum.cadet-web.de/s.leweke/32/1323_2.png) [@s.leweke](https://forum.cadet-web.de/u/s.leweke)\
**Post date:** [September 10, 2020, 6:10pm UTC](https://forum.cadet-web.de/t/empty-sim-object/167/4 "2020-09-10T18:10:29Z")

</div>

This seems strange, indeed. Let’s find out what the `rpath` of the `CadetMex.mexmaci64` dynamic library is:  
Please run this in the terminal in the folder of the `CadetMex.mexmaci64` file and post the results:

```bash
otool -l CadetMex.mexmaci64 | grep RPATH -A10

```

---

<div class="post-metadata">

**Author:** ![agedwards](https://forum.cadet-web.de/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@agedwards](https://forum.cadet-web.de/u/agedwards)\
**Post date:** [September 11, 2020, 7:11pm UTC](https://forum.cadet-web.de/t/empty-sim-object/167/5 "2020-09-11T19:11:36Z")

</div>

Ah, this looks like the answer. I moved the entire folder into a dropbox location for sharing. A path correction should fix it. Unfortunately I’m not sure how to do that.

Many thanks,  
Andy

* * *

cmd LC\_RPATH  
cmdsize 48  
path /Users/Andy/Desktop/CADET/cadet/lib (offset 12)  
Load command 19  
cmd LC\_RPATH  
cmdsize 56  
path /Applications/MATLAB\_R2019a.app/bin/maci64 (offset 12)  
Load command 20  
cmd LC\_RPATH  
cmdsize 64  
path /Applications/MATLAB\_R2019a.app/extern/bin/maci64 (offset 12)  
Load command 21  
cmd LC\_RPATH  
cmdsize 72  
path /Users/Andy/Desktop/CADET/Libs/tbb-2020.3-mac/tbb/lib (offset 12)  
Load command 22  
cmd LC\_RPATH  
cmdsize 32  
path @executable\_path/. (offset 12)

---

<div class="post-metadata">

**Author:** ![s.leweke](https://forum.cadet-web.de/user_avatar/forum.cadet-web.de/s.leweke/32/1323_2.png) [@s.leweke](https://forum.cadet-web.de/u/s.leweke)\
**Post date:** [September 12, 2020, 11:03am UTC](https://forum.cadet-web.de/t/empty-sim-object/167/6 "2020-09-12T11:03:31Z")

</div>

I think, I was wrong in the other post. The correct `rpath` should probably be `@loader_path` instead of `@executable_path`. Please add the `@loader_path` to `CadetMex.mexmaci64`:

```auto
install_name_tool -add_rpath @loader_path/. CadetMex.mexmaci64

```

The `@executable_path` points to the directory that contains the running binary (i.e., `/Applications/MATLAB_R2019a.app/bin/maci64/`). But we need the path relative to the directory of the `.dylib` (i.e., relative to the directory of `CadetMex.mexmaci64` itself), which is given by `@loader_path`.

If this works, you should be able to move the folder around without having to change the files. I’ll also update the other post if this fixes the problem.

---

<div class="post-metadata">

**Author:** ![agedwards](https://forum.cadet-web.de/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@agedwards](https://forum.cadet-web.de/u/agedwards)\
**Post date:** [September 14, 2020, 5:36am UTC](https://forum.cadet-web.de/t/empty-sim-object/167/7 "2020-09-14T05:36:26Z")

</div>

Worked perfectly.

Thanks, Sam.

Andy

---

<div class="post-metadata">

**Author:** ![h.lanzrath](https://forum.cadet-web.de/user_avatar/forum.cadet-web.de/h.lanzrath/32/1186_2.png) [@h.lanzrath](https://forum.cadet-web.de/u/h.lanzrath)\
**Post date:** [January 27, 2026, 7:28am UTC](https://forum.cadet-web.de/t/empty-sim-object/167/8 "2026-01-27T07:28:44Z")

</div>


