Jump to content
Sign in to follow this  

Tip for loading external data programatically

Recommended Posts

Hi everyone,


I have a tip I think might be helpful to others as it is helpful to me to load external data files in my Activate models without having to worry about the file path to the data if the model is moved/shared with someone else.


If you have data in external files (e.g. like a .mat file or whatever), you may load this into Activate with commands in the Model or Diagram Contexts.  Here you need to either have a relative or absolute path to the file:

load('my_model_data.mat') <-- must be in the directory set in "File Browser"






However, if you want to make your model more generic and portable to other directories, you can use the command "bdeGetCurrentModelFilePath", which returns the same path as your Activate model.  Then, you can define the model data relative to your model path (e.g., like in the same directory, as below):





This is nice when sharing models with others so the paths can be set automagically.


Hope this helps someone...





Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...