Error using fopen for obj file

9 ビュー (過去 30 日間)
Benjamin
Benjamin 2024 年 1 月 17 日
移動済み: Dyuman Joshi 2024 年 1 月 24 日
Hi all,
Using MATLAB to open an obj file, fopen is currently throwing up -1: Hence fgets is throwing up an error!
Top level code looks as follows:
modName = 'Slender_solar';
modIn = fullfile(ADBSat_path,'inou','obj_files',[modName,'.obj']);
Then in the import function of the code: Note fileIn is designated as ModIn
fid = fopen(fileIn,'r');
line = fgets(fid);
Any idea of what could be going wrong?
Cheers
  2 件のコメント
Benjamin
Benjamin 2024 年 1 月 20 日
移動済み: Dyuman Joshi 2024 年 1 月 24 日
Will take a look, cheers!

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

採用された回答

Star Strider
Star Strider 2024 年 1 月 17 日
A returned value of -1 means that fopen can’t open the file.
First, run:
which fileIn
to see if MATLAB can find it. If not, provide the correct path to it in your fullfile call.
  2 件のコメント
Benjamin
Benjamin 2024 年 1 月 20 日
Thanks, solved my issue!
Star Strider
Star Strider 2024 年 1 月 20 日
My pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLow-Level File I/O についてさらに検索

タグ

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by