MATLAB Troubleshooting Matlab: Issues with Saving and Loading FNET Variable

  • Thread starter Thread starter Old Guy
  • Start date Start date
  • Tags Tags
    Matlab
AI Thread Summary
The discussion centers around the variable FNET saved to a hard drive using MATLAB's save command. The user notes that while FNET appears in the correct directory, it is labeled simply as "File" in Windows Explorer instead of the expected MATLAB M-file format. The user seeks clarification on this file type designation. Additionally, the user is facing challenges loading the FNET variable with various load commands, including "load FNET" and "load fullfile(BasePath,'FNET.mat')", which have not been successful. They also express confusion about the relationship between variable names and file names in MATLAB, specifically whether changing the file name affects the variable name. The user seeks confirmation that the variable name remains unchanged even if the file name is altered, which they find logical.
Old Guy
Messages
101
Reaction score
1
I have calculated a variable called FNET. I have saved FNET to the hard drive using the following command:

save(fullfile(BasePath,'FNET'),'FNET','-mat')

BasePath is a string that gets the file to the correct directory on my hard drive.

First Question: FNET shows up in the correct place, but in Windows Explorer the file type is shown as "File" rather than (what I would expect) MATLAB M-file. Why?

Second Question: I've written a program that needs to load this variable. None of the following commands have worked:
load FNET
load fullfile(BasePath,'FNET.mat')
and various other attempts.

Please help!
 
Physics news on Phys.org
I may have figured this out, which raised another question that I hope someone can answer for me. I had saved the variable in a file with the same name as the variable. However, I realized later that the file name was not exactly the same as the variable name, so I changed the file name. Apparently, this did not change the variable name. Is it correct that if you save a variable in a file, and change the file name, the variable name remains unchanged? This seems logical, but I would appreciate verification that Matlab actually works that way. Thanks.
 

Similar threads

Replies
4
Views
2K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
1
Views
3K
Replies
3
Views
23K
Replies
2
Views
3K
Replies
1
Views
2K
Replies
1
Views
3K
Back
Top