Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab save/load question

  1. Jan 2, 2010 #1
    I have calculated a variable called FNET. I have saved FNET to the hard drive using the following command:


    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!
  2. jcsd
  3. Jan 2, 2010 #2
    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook