- #1
Yosty22
- 185
- 4
Homework Statement
This isn't really for homework, but I wasn't sure where else to put it. anyone wishes to move it, that is fine. I'm just getting into some research and I was tasked with reading data from a text file into MatLab and then graphing it by fitting it with exponentials. I am very new to MatLab, so I am just trying to read the data in as of right now, and I'm not sure what's going wrong. I have used many sources online and I have done almost exactly what they said.
My code right now is as follows:
filename = 'aucdstio2_long_ave_combined';
fileID = fopen(filename,'r');
temp = textscan(fileID, '%s%s');
I am using the part '%s%s' because the file is formatted as:
-1.0000000e+003 1.5354302e+002
This is an example of the first line, but there are around 500 lines that are all identical to this. I figured due to the "e+003" it would be better to read it in as a string. However, when I try to run it, I keep getting the error: "
Error using textscan
Invalid file identifier. Use fopen to generate a valid file identifier.
Error in Data_ReadIn_aucdstio2_long_ave_combined (line 5)
temp = textscan(fileID, '%s%s');
It is weird to me, because this is exactly what various sites I have found have said.
Any ideas what's going on here?
Homework Equations
N/A
The Attempt at a Solution
My attempt is shown above