In the Log Management
block, a big mux goes into a file scope (xPC scope set to file). Here, add all the signals you want to log.
f = xpctarget.fs(tgfree); % connect to the filesystem
f.dir % see the contents
f.removefile('filename.dat'); % delete a file
In LokoMatControl/scripts/getxpcdata.m
Connects to target xPC (tgfree)
f = xpctarget.fs(tgfree);
lokofree.dat
filefilename = 'lokofree.dat';
h=fopen(f,filename);
data = fread(f,h);
fclose(f,h);
x.data
x = readxpcfile(data);
i_time = size(x.data,2);
time = x.data(:,i_time);
signal = data.data(:,1);
% Plot the results
figure;
plot(time, signal);
title('LokoFree Data');
xlabel('time (s)');
ylabel('Signal');
f = xpctarget.fs(tgfree);
filename = 'lokofree.dat';
h=fopen(f,filename);
data = fread(f,h);
fclose(f,h);
data = readxpcfile(data);
signal = data.data(:,1);
time = data.data(:,2);
% Plot the results
figure;
plot(time, signal);
title('LokoFree Data');
xlabel('time (s)');
ylabel('Signal')
This happens when you are saving too much data, probably by overflowing the buffer.
Increase the buffer size, (number of samples), and divide the data over multiple files (create multiple file scopes)
If the dataset is too large, for some reason sometimes the readxpcfile method (through a script) causes and index error. Manually doing it through the workspace has fixed this for whatever reason. Error below:
Error using xpctarget.utils.readxpcfile (line 14)
Message: Index was outside the bounds of the array.
Source: xPCFramework
HelpLink:
Error in readxpcfile>readxpcfile_internal (line 60)
file = xpctarget.utils.readxpcfile(data);
Error in readxpcfile (line 49)
file = readxpcfile_internal(inputvalue);
Error in fcn_saveTrialData (line 26)
data = readxpcfile(data_);
Error in fcn_saveTrialDataCallback (line 24)
fcn_saveTrialData(tgfree,fileNameStr,trialNumber,dataFolder,remoteFileNames, false);
Error while evaluating uicontrol Callback