File addressing of code for MATLAB compiler

1 回表示 (過去 30 日間)
Jack
Jack 2014 年 8 月 1 日
コメント済み: Jack 2014 年 8 月 2 日
In my codes, there are some functions like imshow or fopen files that need addressing. When I use my program in MATLAB I use pwd like imshow([pwd '/image.jpg']) for addressing and the program run and work correctly, but when I compiled my program after installing it (redistribution) when I open shortcut in desktop, an error message appear with the title that my program can't find image.jpg . When I check the address of searching, it is like :
C:/User/Desktop/image.jpg
I read this page but I don't know how to use this addressing.
Beside It I don't know where I should add these files ( images and texts ) in MATLAB compiler options. In file required for your application to run or file installed with your application.
Ps.
I have some folders beside my files with image and text files. How can I have this structure after compiling the application?
Thanks.

採用された回答

Image Analyst
Image Analyst 2014 年 8 月 2 日
You can hard code the file location where you know these files will be into your imread() or fopen() commands, or you can put them in the same folder as your executable or some subfolder if you use the -a option of the mcc compiler command. Or they can be on the search path.
It's also recommended to use fullfile() rather than literal string concatenation like you did (though that's not what's causing your problem).
Also, see the FAQ on the compiler:
  1 件のコメント
Jack
Jack 2014 年 8 月 2 日
Thank you for answer.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by