Why does Matlab not recognize my .txt file as readable using csvread, and how do I fix it?
2 views (last 30 days)
Show older comments
I am trying to use Matlab in order to quickly analyze data from a group of large Excel files, so my plan was to convert them into CSV format and use the csvread function in order to import and analyze them. However, when I try to run my code it give me the following error:
"Undefined function or variable 'TestWaveform1Edit'. Error in WaveformAnalysis (line 8)"
My code is as follows:
Data = csvread(TestWaveform1Edit, 0, 0, [1 0 rowBound 8]);
"TestWaveform1Edit" is a .txt file, formatted to be readable as a .csv file, as directly saving my excel workbooks as .csv files did not work. Has anyone had this issue, and what am I doing wrong in my implementation of the csvread function? I have yet to get it to work with any files, even smaller, simpler ones that I created outside of Excel.
0 Comments
Accepted Answer
Adam
on 20 Feb 2017
Unless TestWaveform1Edit is a variable containing the name of your file then of course this will not work. The filename needs to be provided as a string/char e.g.
Data = csvread('TestWaveform1Edit', 0, 0, [1 0 rowBound 8]);
Whether that is enough on its own I don't know. I tend to prefer to provide a full path to most files I use, but if it is on your Matlab path then it should find it, though you probably need the extension on the end too.
More Answers (0)
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!