フィルターのクリア

How do I import text file through GUI and create a matrix with some of the datat?

1 回表示 (過去 30 日間)
Bill
Bill 2014 年 10 月 16 日
回答済み: Rainer 2014 年 10 月 16 日
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

採用された回答

Rainer
Rainer 2014 年 10 月 16 日
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 件)

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by