0

I am trying to save part of my workspace in matlab.
lets say .

    a=1 
    b=3
    name1='file_a.mat'
    save(name1,a)

and got

Error using save
Argument must contain a character vector.    

I also tried .

save name1 a 

this generated a file named name1 (instead of file_a.mat) . I am using matlab 2017 on mac .

thank you

1
  • The documentation for save explains the inputs and their necessary data type(s). Commented Mar 19, 2018 at 19:21

1 Answer 1

2

The name of the variable you want to save must be passed to save as a string:

a=1 
b=3
name1='file_a.mat'
%          v-v here
save(name1,'a')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.