Clear Filters
Clear Filters

How to use a relative path for NET.addAssembly

4 views (last 30 days)
My matlab code is in D:\CERDEC\liveFeed, but I find I have to use a full path:
function setup(this)
this.asm = NET.addAssembly('D:\CERDEC\liveFeed\bin\Debug\liveFeed.dll');
this.feed = liveFeed.Feeder('me');
end
I get an error when I try to use:
this.asm = NET.addAssembly('.\bin\Debug\liveFeed.dll');

Accepted Answer

Guillaume
Guillaume on 19 Oct 2017
Well, you have no guarantee that the current matlab working directory is 'D:\CERDEC\liveFeed\'. And honestly, it is much better to always work with full paths. But if you really want to use a relative path, you can use pwd to query the current working directory, so:
this.asm = NET.addAssembly(fullfile(pwd, '.\bin\Debug\liveFeed.dll'));
  5 Comments
Doctor G
Doctor G on 19 Oct 2017
never-mind, I see I have to run this inside the class.m file.
Thanks for all the speedy answers.

Sign in to comment.

More Answers (0)

Categories

Find more on Search Path in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!