Matlab not recognizing 'filename' command

7 views (last 30 days)
Kylie Soliday
Kylie Soliday on 24 Jan 2015
Answered: Star Strider on 25 Jan 2015
I used Matlab's built in script creator for importing data from a csv file, and when you do that, it automatically defines the variable 'filename' to be the name of the file you're importing. When I try to call on it later to export the data, it keeps giving me the error:
Undefined function or variable 'filename'.
Error in test (line 269) outputfile=regexprep(filename,'.csv','1out.xlsx');
Any ideas on why it's claiming that the variable it defined isn't defined?

Answers (1)

Star Strider
Star Strider on 25 Jan 2015
Check your ‘Workspace’ window to see if ‘filename’ exists in your workspace.
Another option is:
whos('filename')

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!