Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using fscanf Invalid file identifier. Use fopen to generate a valid file identifier. #10

Closed
Aayush146 opened this issue Jan 10, 2022 · 7 comments

Comments

@Aayush146
Copy link

Hi, I tried implementing the code, but I keep getting the mentioned error. It could have something to do with the file path being created to store all the results. I am quite new to MATLAB, so I was wondering if anyone could help me out.

The complete error looks like this:

Error using fscanf
Invalid file identifier. Use fopen to generate a valid file identifier.

Error in ax_mesh>AxiMesh (line 105)
ligne=fscanf(fid,'%s',2);

Error in ax_mesh (line 25)
[Mass, Inertia, KHyd, XB,YB,ZB] = AxiMesh(r,z,n)

@ruddykurnia
Copy link

Hi,

Perhaps, you could start with the attached files, places the files into your NEMOH source code folder, and try to execute a test case in get_started0.m. Please let me know if you still have the same problem.
get_started_NEMOH_MATLAB.zip

Regards,
Ruddy

@Aayush146
Copy link
Author

Hi, thanks for your reply. I am getting a new error now:
The system cannot find the path specified.
Error using fscanf
Invalid file identifier. Use fopen to generate a valid file identifier.

Error in axiMesh (line 101)
ligne=fscanf(fid,'%s',2);

Error in get_started0 (line 67)
[Mass,Inertia,KHyd,XB,YB,ZB]=axiMesh(r,z,n);% Call the function axiMesh.

It may be because I have put it in a wrong folder, but I am unsure.

@ikaushik007
Copy link

Hello there, so I am trying to use Nemoh to find my coefficients for a sphere for use in WEC-sim. I used BEMROSETTA to convert my STL files into NEMOH.dat file for input into NEMOH and then planned to use the coefficients obtained from NEMOH in WEC-Sim for analysis of my device.

However, when I run Nemoh through MATLAB, I get the same error. full error below

Error using fgets
Invalid file identifier. Use fopen to generate a valid file identifier.

Error in fgetl (line 32)
[tline,lt] = fgets(fid);

Error in Nemoh (line 104)
ligne=fgetl(fid);

Error in nemoh_run (line 9)
[A,B,Fe]=Nemoh(w,dir,depth);

Is there any guide on using an already mesh and running nemoh.

@gducrozet
Copy link
Member

Hello @ikaushik007 and @Aayush146
It looks like an error external to NEMOH, check the path and name of the file you provide as input. Matlab simply tells you that he cannot read the file. You should have prior to the 'fgets' command a 'fid=fopen(...)' to tell the code which file you open!?

Best,
G.

@ikaushik007
Copy link

Hello @ikaushik007 and @Aayush146 It looks like an error external to NEMOH, check the path and name of the file you provide as input. Matlab simply tells you that he cannot read the file. You should have prior to the 'fgets' command a 'fid=fopen(...)' to tell the code which file you open!?

Best, G.

fid=fopen([rep,filesep,'results',filesep,'ExcitationForce.tec'],'r');

The above is the line 104 where the error occurs.

@gducrozet
Copy link
Member

And if you display [rep,filesep,'results',filesep,'ExcitationForce.tec'] it is really pointing toward your file?

@gducrozet
Copy link
Member

This project has migrated to GitLab: https://gitlab.com/lheea/Nemoh

If the issue is still active in the new Release, feel free to open an issue there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants