How to write a function that reads a log file and outputs structures with the relevant data?
Show older comments
I want to create a function which will prompt the user to select a LogFile.txt file using uigetfile. (I have attached the file I want to read)
In the file the ‘important’ fields are: Event Type (that describes whether there was a scanner pulse, a picture presentation or a button press), code (which describes the type of event) and time, (time of the event, in tenths of milliseconds). The function should output a structure LogTimes with the following fields:
1. PD2: Time (in milliseconds!) of the picture indicating a press with the second finger( ‘Picture D2 ’).
2. D2: Time (in milliseconds) of the button press with the second finger. 1
3. PD4: Time (in milliseconds) of the picture indicating a press with the fourth finger( ‘Picture D4 ’).
4. D4: Time (in milliseconds) of the button press with the fourth finger.
I have no idea how to approach this, any help would be appreciated!!
1 Comment
Michael Keeling
on 5 Jun 2020
You can use Import File to generate a function that will import the data consistently for you, and generate the structure from there.
Answers (0)
Categories
Find more on App Building in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!