Invalid file identifier. Use fopen to generate a valid file identifier.

7 commentaires

the cyclist
the cyclist le 25 Fév 2021
Modifié(e) : the cyclist le 25 Fév 2021
What's your question?
From your screenshot, I would suggest that you have provided an invalid file identifier to the function solve_TFB, and you should generate a valid identifier using fopen.
I realize that that is not very helpful advice ... but you really haven't given us any relevant information to help more than that. Maybe read the documentation for fopen?
I don't recognize solve_TFB as a MATLAB function provided by MathWorks, and neither does Google. Where does that come from?
That is a .p file (solve_TFB). I was told that I cant open it but rather use it in a function. Thats what i tried to do and got this error.
OK. Presumably the first argument should be a file id, as output by the fopen command. Your screenshot doesn't really show how you are calling the function. (It's generally better to share copy/pasted code and error messages, not screenshots.)
This is the error
Error using textscan
Invalid file identifier. Use fopen to generate a valid file identifier.
Error in solve_TFB
Error in solve_TFB
Error in a01_getStressResults_done (line 21)
solve_TFB(inputFile,M_xx,M_yy)
Code:
% path to input file
inputFile = [cd '\Absatz_Biegung.inp'];
% moment about x-axis
M_xx = 0;
% moment about y-axis
M_yy = 400;
%%
%%% call solver and receive the following data:
% nodes --> list of nodes with corresponding coordinates
% elements --> list of elements with corresponding node IDs
% u --> displacement vector
% colorData_u --> magnitude of displacement at nodes
% stressTensor --> (Voigt) stress tensors extrapolated to nodes
% colorData_s --> von Mises stress at nodes
[nodes,elements,u,colorData_u,stressTensor] = ...
solve_TFB(inputFile,M_xx,M_yy);
It's not clear to me what the solve_TFB file is expecting, but what you've done here does seem correct. Does
help solve_TFB
provide any information?
By default calling help on a p-file will not provide information, unless they also provided an accompanying m-file with just the help info.
File Absatz_Biegung.inp does not exist in the current directory, or cannot be opened.

Connectez-vous pour commenter.

Réponses (1)

Hi!
The problem seems to have occurred because the file does not exist or cannot be opened.Try providing the correct path to the file Absatz_Biegung.inp”.
Even after providing the correct path to input file, if it does not work, then refer to the documentation of fopen and try passing fileID for the inputFile parameter.

1 commentaire

Oh and use fullfile() instead of concatenation of character vectors for directory and file name. The \ separator is not valid in Linux or MacOS

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by