Troubleshooting Matlab: Issues with Saving and Loading FNET Variable

  • Context: MATLAB 
  • Thread starter Thread starter Old Guy
  • Start date Start date
  • Tags Tags
    Matlab
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 5K views
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.