フィルターのクリア

manipulating the imported data using textscan

1 回表示 (過去 30 日間)
Sanwal Yousaf
Sanwal Yousaf 2016 年 1 月 14 日
コメント済み: Walter Roberson 2016 年 1 月 14 日
I have used textscan to import data from a text file. The data has indeed been imported and it is stored as cell array. The string contains the data that has two sections and i want the section that has the data for calculated reaction time and not raw reaction time. There are no obvious delimiters that will be repeated and the number of rows in the calculated reaction times vary because it is generated by the responses from the test subjects. My code seems to work so far, but the next step would be to isolate the data from the cell using a loop i suspect. I am open to any and all ideas. I am also attaching the file in question to this question.
[filename] = uigetfile('*', 'Select the data file') %feed the data file here with the reaction times.
import_data = importdata(filename) %This function imports the reaction data from the file
[data] = import_data.data
fid = fopen(filename,'r')
scan_init_cell = textscan(fid, '%s %s %s', 'headerlines',18, 'CollectOutput', 1,...
'TreatAsEmpty',{'Responsed to Nothing','Missed Response'})
fclose(fid)
scan_init = [scan_init_cell{:}]
scan_init_cell = cellfun(@isnan, scan_init, 'un', 0);
%file_string = scan_init_cell{1};

採用された回答

Walter Roberson
Walter Roberson 2016 年 1 月 14 日
What is it that needs to be done that is not done by the solution I provided in http://uk.mathworks.com/matlabcentral/answers/263082-skipping-the-lines-in-a-txt-file-before-importing-it#comment_333996 ?
  2 件のコメント
Sanwal Yousaf
Sanwal Yousaf 2016 年 1 月 14 日
Your solution works fine. I am new with cell arrays and i am not sure how i would take these cell arrays and use them to retrieve data from these cell arrays and manipulate them to work with the rest of my code.
Walter Roberson
Walter Roberson 2016 年 1 月 14 日
The scan_init variable I produced there is a numeric array. You would have no further use of the cell array unless you wanted to look at the strings that had been used in place of some of the reaction times.

サインインしてコメントする。

その他の回答 (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