フィルターのクリア

How to use a relative path for NET.addAssembly

5 ビュー (過去 30 日間)
Doctor G
Doctor G 2017 年 10 月 19 日
編集済み: Doctor G 2017 年 10 月 24 日
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');

採用された回答

Guillaume
Guillaume 2017 年 10 月 19 日
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 件のコメント
Doctor G
Doctor G 2017 年 10 月 19 日
never-mind, I see I have to run this inside the class.m file.
Thanks for all the speedy answers.
Doctor G
Doctor G 2017 年 10 月 24 日
編集済み: Doctor G 2017 年 10 月 24 日

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by