I am keep on getting this error in my matlab code when i try to execute this code.
3 views (last 30 days)
Show older comments
Error in thermdata (line 2)
cd 'C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic arm\Thermdynamics Parsing NASA';
This is the error mentioned above which i am keep on getting. I will copy and paste all the text in my command window. One of my frind told me it could be related to the incorrect file as well.
Command window.
thermdata
Current directory: /MATLAB Drive
Contents of the directory:
curvefittingg.m Editor_dusyp f.m odecylce.m quadratic.m unn.m
curvefitting.m Editor_mxxlx fprintf.m ode_func.m quiz3.m untitled.m
data.m Editor_pnwvg hhh.m pp.m thermdata.m Welcome.mlx
Editor Editor_wacxv hyper.m Published totalcost.m
Error using thermdata
Could not open the file: thermo.dat
thermdata
Warning: Function fprintf has the same name as a MATLAB built-in. We suggest you rename the function to avoid a potential name conflict.
Error using cd
Unable to change current folder to '/MATLAB Drive/C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic
arm\Thermdynamics Parsing NASA' (Name is nonexistent or not a folder).
Error in thermdata (line 2)
cd('C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic arm\Thermdynamics Parsing NASA');
thermdata
Warning: Function fprintf has the same name as a MATLAB built-in. We suggest you rename the function to avoid a potential name conflict.
Error using cd
Unable to change current folder to '/MATLAB Drive/C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic
arm\Thermdynamics Parsing NASA\thermodata.m' (Name is nonexistent or not a folder).
Error in thermdata (line 2)
cd 'C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic arm\Thermdynamics Parsing NASA\thermodata.m'
Warning: Function fprintf has the same name as a MATLAB built-in. We suggest you rename the function to avoid a potential name conflict.
thermdata
Warning: Function fprintf has the same name as a MATLAB built-in. We suggest you rename the function to avoid a potential name conflict.
Error using cd
Unable to change current folder to '/MATLAB Drive/C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic
arm\Thermdynamics Parsing NASA' (Name is nonexistent or not a folder).
Error in thermdata (line 2)
cd 'C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic arm\Thermdynamics Parsing NASA';
thermdata
Error using cd
Unable to change current folder to '/MATLAB Drive/C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic
arm\Thermdynamics Parsing NASA' (Name is nonexistent or not a folder).
Error in thermdata (line 2)
cd 'C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic arm\Thermdynamics Parsing NASA';
Warning: Function fprintf has the same name as a MATLAB built-in. We suggest you rename the function to avoid a potential name conflict.
thermdata
Warning: Function fprintf has the same name as a MATLAB built-in. We suggest you rename the function to avoid a potential name conflict.
Error using cd
Unable to change current folder to '/MATLAB Drive/C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic
arm\Thermdynamics Parsing NASA' (Name is nonexistent or not a folder).
Error in thermdata (line 2)
cd 'C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic arm\Thermdynamics Parsing NASA';
Warning: Function fprintf has the same name as a MATLAB built-in. We suggest you rename the function to avoid a potential name conflict.
thermdata
Warning: Function fprintf has the same name as a MATLAB built-in. We suggest you rename the function to avoid a potential name conflict.
Error using cd
Too many input arguments.
Error in thermdata (line 2)
cd C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic arm\Thermdynamics Parsing NASA
Warning: Function fprintf has the same name as a MATLAB built-in. We suggest you rename the function to avoid a potential name conflict.
thermdata
Error using cd
Unable to change current folder to '/MATLAB Drive/C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic
arm\Thermdynamics Parsing NASA' (Name is nonexistent or not a folder).
Error in thermdata (line 2)
cd 'C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic arm\Thermdynamics Parsing NASA';
thermdata
Error using cd
Unable to change current folder to '/MATLAB Drive/C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic
arm\Thermdynamics Parsing NASA' (Name is nonexistent or not a folder).
Error in thermdata (line 2)
cd 'C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic arm\Thermdynamics Parsing NASA';
thermdata
Error using cd
Unable to change current folder to '/MATLAB Drive/C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic
arm\Thermdynamics Parsing NASA' (Name is nonexistent or not a folder).
Error in thermdata (line 2)
cd 'C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic arm\Thermdynamics Parsing NASA';
0 Comments
Answers (1)
Steven Lord
on 28 Feb 2024
Why have you written your own fprintf.m file? That means you won't be able to call the fprintf function that is part of MATLAB and is the reason for some of the warning messages. I advise you to rename or remove your fprintf.m.
The relevant message appears to be:
Error using cd
Unable to change current folder to '/MATLAB Drive/C:\Users\joelg\OneDrive\Desktop\Advanced technologies in mechanical engineering\DevelopingNumericSortingAlgorithm\CodeForRpbotic
arm\Thermdynamics Parsing NASA' (Name is nonexistent or not a folder).
Are you using MATLAB Online? If so I'm fairly sure it won't be able to access files in your OneDrive and certainly wouldn't be able to do so using a Windows path. I think you're going to need to upload those files to MATLAB Drive or make them available via MATLAB Drive Connector.
But at a quick glance, are you sure the folder path is correct? Should "CodeForRpbotic arm" be "CodeForRobotic arm" and should "Thermdynamics Parsing NASA" be "Thermodynamics Parsing NASA"?
2 Comments
Walter Roberson
on 28 Feb 2024
[f1, msg] = fopen(file_path, 'r');
% Check if file opening was successful
if f1 == -1
error('Could not open the file because: %s', msg);
end
See Also
Categories
Find more on Reference Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!