How do I import text file through GUI and create a matrix with some of the datat?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Bill
el 16 de Oct. de 2014
Respondida: Rainer
el 16 de Oct. de 2014
Attached is a sample of the file I am trying to import and analyze the data in it. Below is what I've tried to code into the GUI I am trying to create. At this point I just want to see if I am reading the data in correctly. I only seem to get the first column of seven of the data. Any suggestions.
function browse_Callback(hObject, eventdata, handles)
% hObject handle to browse (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
[filename pathname]=uigetfile({'*.rcs'},'Xpatch RCS File');
fullpathname = strcat(pathname, filename);
set(handles.showpathname, 'String', fullpathname) % showing full pathname
fid=fopen(fullpathname);
text=textscan(fid, '%f %f %f %f %f %f %f', 'Delimiter', 'tab',... 'CommentStyle', '#');
fclose(fid);
text=text{:};
set(handles.data, 'String', text); % show data
0 comentarios
Respuesta aceptada
Rainer
el 16 de Oct. de 2014
seems like your file is delimited by space and not tabs. one easy way to troubleshoot the import is to drag the txt file into your matlab workspace. The import wizard will then open and from doing that, i see maybe you need to change your import from "delimited" to "fixed width". Then you can "generate script" to get the import script.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Text Files en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!