Troubleshooting Matlab: Issues with Saving and Loading FNET Variable

  • Context: MATLAB 
  • Thread starter Thread starter Old Guy
  • Start date Start date
  • Tags Tags
    Matlab
Click For Summary
SUMMARY

The discussion centers on troubleshooting issues related to saving and loading a variable named FNET in MATLAB. The user saved the variable using the command save(fullfile(BasePath,'FNET'),'FNET','-mat'), but encountered problems with file recognition in Windows Explorer, where the file type appears as "File" instead of a MATLAB M-file. Additionally, attempts to load the variable using commands like load FNET and load fullfile(BasePath,'FNET.mat') were unsuccessful. The user confirmed that changing the file name does not alter the variable name saved within the file, which is a standard behavior in MATLAB.

PREREQUISITES
  • Familiarity with MATLAB file handling commands
  • Understanding of MATLAB variable and file naming conventions
  • Basic knowledge of Windows file system behavior
  • Experience with MATLAB's workspace and variable management
NEXT STEPS
  • Research MATLAB's save and load functions in detail
  • Explore MATLAB's workspace management and variable persistence
  • Learn about MATLAB file formats and their implications
  • Investigate common file system issues in Windows related to MATLAB files
USEFUL FOR

MATLAB users, data analysts, and researchers who need to manage variable persistence and troubleshoot file handling issues in MATLAB.

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 ·
Replies
4
Views
7K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
1
Views
4K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
13K
Replies
2
Views
3K