Reputation: 1
I have a Variable which is part of the Name of my Textfile:
Test123_Variable.txt
Now I want to use the Function fopen to open the textfile, but since my Filename is dependent on the name of my variable I don't know how to make the right syntax:
This is obviously not working:
filename = ("Test123_Variable.txt");
How can I fix this?
Upvotes: 0
Views: 556
Reputation: 911
If i understand right your purpose,
filename = ["Test123_" Variable ".txt"];
should do what you expect. Example:
>> Variable = "sample_1";
>> filename = ["Test123_" Variable ".txt"]
filename = Test123_sample_1.txt
Upvotes: 1