Filter löschen
Filter löschen

Error using fopen for obj file

4 Ansichten (letzte 30 Tage)
Benjamin
Benjamin am 17 Jan. 2024
Verschoben: Dyuman Joshi am 24 Jan. 2024
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

Akzeptierte Antwort

Star Strider
Star Strider am 17 Jan. 2024
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 Kommentare
Benjamin
Benjamin am 20 Jan. 2024
Thanks, solved my issue!
Star Strider
Star Strider am 20 Jan. 2024
My pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by