How to use a relative path for NET.addAssembly

5 Ansichten (letzte 30 Tage)
Doctor G
Doctor G am 19 Okt. 2017
Bearbeitet: Doctor G am 24 Okt. 2017
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');

Akzeptierte Antwort

Guillaume
Guillaume am 19 Okt. 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 Kommentare
Doctor G
Doctor G am 19 Okt. 2017
never-mind, I see I have to run this inside the class.m file.
Thanks for all the speedy answers.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by