Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
Jaewon

Administrator
Registered:
Posts: 730
Reply with quote  #1 
Hi DHaehnke,

I moved your question here as a separate thread so that it doesn't get buried in other posts.

-----

Could you please document how to use mlbhv2 with the append mode? Specifically, I'd like to append the TimingFileByCond information to older files.
Is it also possible to add things to mlconfig? Or even to change things?
0
Jaewon

Administrator
Registered:
Posts: 730
Reply with quote  #2 
Please refer to the following code. BHV2 is not designed for partial updates. So read the whole file and write it again.

-----
[bhv2_name,p] = uigetfile({'*.bhv2','BHV2 Files (*.bhv2)'},'Select BHV2');
cd(p);

bhv2 = mlbhv2(bhv2_name,'r');  % open the file for read only
data = bhv2.read();
bhv2.close();

data.TrialRecord.TaskInfo.TimingFileByCond = [];  % place the value you want to assign

bhv2.open(bhv2_name,'w');  % re-open the file for write. The original file will be deleted.
for f = fieldnames(data)'
    bhv2.write(data.(f{1}),f{1});  % write(value,name)
end
bhv2.close();

0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.