Loading/Reading .log File

조회 수: 226 (최근 30일)
Alexandra Rowan O'Donnell
Alexandra Rowan O'Donnell 2019년 5월 30일
답변: Alexandra Rowan O'Donnell 2019년 5월 31일
Hey all --
I'm trying to rework some code from one type of experiment to another that uses .log files. The problem is that I can load up the .log file from the example data set no problem, but when I plug in my .log file, it only reads the first 5 rows and none of the columns. What should be a 247x13 matrix filled with behavior is just a 5x1. The lines I'm using look like this:
clear
NameF='MG125';
BehaviorDirectory=['D:\Timing Task\MG125\'];
logfilename='omar_timing_test_MG125_Block_1.log';
%% Synchronize log file to electrophysiology
% This bit requires importing the information in the log (or csv) file,
% running to get the trial specifics from the log file, and putting
% everything into a matrix called 'MatrixBeh', which has a header variable,
% 'MatrixBehHeaders'. 'MatrixBeh is modeled off of the CSV files created
% for Psychtoolbox for MSIT or ECR, depending on the output. The variables
% below should be semi-self explanatory.
A = importdata([BehaviorDirectory,'\',logfilename]); %Import from the log file
LogInfo=A.textdata;
The .log files are exactly the same layout, exactly the same column headers, exactly the same everything. I have tried using this but it didn't work for me because it didn't recognize the .log as a valid file type:
data = readtable('omar_timing_test_MG125_Block_1.log')
Any thoughts on why it works for one and not the other would be greatly appreciated!
  댓글 수: 1
dpb
dpb 2019년 5월 30일
We'd have to see a sample of both files to be able to know...or at least the code that wrote yours versus that of the original.

댓글을 달려면 로그인하십시오.

채택된 답변

Alexandra Rowan O'Donnell
Alexandra Rowan O'Donnell 2019년 5월 31일
I ended up importing the log file as a table and then using table2cell to work around the problem.

추가 답변 (1개)

Jeremy Hughes
Jeremy Hughes 2019년 5월 31일
Try this:
data = readtable('omar_timing_test_MG125_Block_1.log','FileType','text')
Jeremy

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by