why the error and how to remove it : Could not open file variable. No such file or directory.

13 views (last 30 days)
I am converting a matlab function to vhdl. During fixed point conversion I get the following error in Build Log.
Error using fileread (line 27) Could not open file variable. No such file or directory.
I have attached the function and testbench. Why it is not able to read the file?
  3 Comments
Jyothirmai
Jyothirmai on 20 Feb 2014
Edited: Jyothirmai on 20 Feb 2014
Even i got the same erros: Error in Float2FixedConverter>buildDesign at 1699
Error in Float2FixedManager>buildFloatingPointCode at 102
Error in fpBuildFloatingPointCode at 4
Error in emlcprivate at 16
how to remove them? Its saying Float2FixedConverter.m doesnot exist do you want to create? Can i get it in net?
amrita
amrita on 5 Sep 2014
This happens when compiler is not configured; floating2fixedconverter.m needs the compiler;
in matlab command prompt run >>mex -setup command

Sign in to comment.

Accepted Answer

Tim McBrayer
Tim McBrayer on 20 Jan 2014
Edited: Tim McBrayer on 20 Jan 2014
Your code is hitting an internal error inside float to fixed conversion. Since you don't detail exactly what you were doing at the time of failure it's hard to understand what the issue is that you are having.
That said, the primary problem with your code, simply by inspection, is that it contains a while loop, which is not supported for HDL code generation. Try rewriting your code to not use any of the following constructs:
  • while
  • break
  • continue
  • return
  • parfor
The requirement to not use these constructs is clearly spelled out in the documentation on the MathWorks Support site for HDL Coder. The identical information is available in the installed help as well.

More Answers (2)

Image Analyst
Image Analyst on 20 Jan 2014
Those files don't mention fileread() and don't even have 27 lines. Please attach the entire error message - ALL THE RED TEXT - don't snip out just a small part of it like you did. Is there any chance in the actual code - the code that you forgot to attach - that you were supposed to use fread() instead of fileread()? What does it say when you do these in the command window:
which fread
which fileread
  1 Comment
priya agarwal
priya agarwal on 20 Jan 2014
Edited: priya agarwal on 20 Jan 2014
Actually all these functions fread/fileread are not in my code. I guess MATLAB is using it itself.
Basically if you consider fcn.m as the main function and fcn_tb.m as test bench and then open the workflow advisor, then run till the task fixed point conversion. At that time you get this error. I'll post the entire red part.
Error using fileread (line 27) Could not open file variable. No such file or directory.
Error in C:\MatlabR2013a\R2013a\toolbox\coder\float2fixed\+coder\+internal\Float2FixedConverter.p>Float2FixedConverter.buildDesign/getUserWrittenFunction (line 1666)
Error in C:\MatlabR2013a\R2013a\toolbox\coder\float2fixed\+coder\+internal\Float2FixedConverter.p>Float2FixedConverter.buildDesign (line 1654)
Error in C:\MatlabR2013a\R2013a\toolbox\coder\coder\+coderprivate\Float2FixedManager.p>Float2FixedManager.buildFloatingPointCode (line 102)
Error in C:\MatlabR2013a\R2013a\toolbox\coder\coder\private\fpBuildFloatingPointCode.p>fpBuildFloatingPointCode (line 4)
Error in C:\MatlabR2013a\R2013a\toolbox\coder\coder\emlcprivate.p>emlcprivate (line 16)
Could not open file variable. No such file or directory.
Error in fileread at 27
Error in Float2FixedConverter>buildDesign/getUserWrittenFunction at 1666
Error in Float2FixedConverter>buildDesign at 1654
Error in Float2FixedManager>buildFloatingPointCode at 102
Error in fpBuildFloatingPointCode at 4
Error in emlcprivate at 16

Sign in to comment.


amrita
amrita on 5 Sep 2014
This happens when compiler is not configured; floating2fixedconverter.m needs the compiler;
in matlab command prompt run >>mex -setup command
  8 Comments
Tim McBrayer
Tim McBrayer on 10 Dec 2014
Yes, this is the correct approach towards ensuring your code can pass through fixed point conversion. I don't know if it will address your original symptom or not.
LRM
LRM on 11 Dec 2014
Thank you very much for your answer.
About the first error - I had created the project (.prj) file in a separate directory, and this was causing the error 'Cannot find design 'Gcode' on the path.'. Now I have created a new .prj file within the directory containing Gcode.m and the associated functions. The fixed point conversion errors (that the tool had pointed out yesterday) are now directly appearing in the HDL coder screen.

Sign in to comment.

Tags

Products

Community Treasure Hunt

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

Start Hunting!