Read in CSV files using GUI
Mostrar comentarios más antiguos
If I want MATLAB to read in the following file using the GUIDE feature in MATLAB:
Source File:
ID:
C
C
C
C
R
F
L
T
E
Date Time Ch:
03/24/2012 28:43.0 -142.315
03/24/2012 28:43.0 -142.316
03/24/2012 28:43.0 -142.318
and so on,
how can I read the file if the extension is not .csv, say, .pl4?
With a .csv I could use the following but that only assumes if the file .csv which in my case it's not.
fid=fopen('filename.csv');
header = textscan(filenamecsv, '%s',3, 'delimeter' ',','headerLines',16);
data=textscan(filenamecsv, '%s %s %s', 'delimiter', ' ,');
data_to_plot=str2double(data{3});
fclose(filenamecsv);
Respuesta aceptada
Más respuestas (1)
T
el 13 de En. de 2013
0 votos
14 comentarios
Walter Roberson
el 13 de En. de 2013
Yes.
fullpath = fullfile(pathname, filename);
fid = fopen(fullpath);
T
el 14 de En. de 2013
T
el 14 de En. de 2013
Walter Roberson
el 14 de En. de 2013
If you put a breakpoint in at the fclose() line, then can you see your data at that point? But then when you single-step the data is gone? Is the fclose() possibly giving an error that might be causing your function to exit, thereby destroying your function's workspace ?
Or is it perhaps not the fclose() that is the problem, and that the problem is that after the fclose() the function ends and you are trying to plot from a different function? If so then see
T
el 14 de En. de 2013
Walter Roberson
el 14 de En. de 2013
You can use figure() to create a new window, and figure() applied to an existing window raises that window to the top.
I recommend you read my comments in http://www.mathworks.co.uk/matlabcentral/answers/22208-show-figure
Walter Roberson
el 16 de En. de 2013
You have not set handles.projectdata.time or handles.projectdata.data_to_plot in that code.
T
el 16 de En. de 2013
T
el 17 de En. de 2013
Walter Roberson
el 17 de En. de 2013
You cannot effectively use a waitbar in that situation, as you have no information about how long the load will take, and you are only doing a single operation (that is, a single textscan()).
Walter Roberson
el 17 de En. de 2013
If you know how long it will take, use a timer object to update it, and hope that the innards of textscan() are not built-in functions (timers cannot interrupt built-in functions.)
Categorías
Más información sobre Environment and Settings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!