Code covered by the BSD License  

Highlights from
xPC File Scope Tools

image thumbnail
from xPC File Scope Tools by Robyn Jackey
Functions to easily save xPC File Scope data to the target PC as MAT files.

xpcdata2vars(xpcdata)
function xpcdata2vars(xpcdata)
% xpcdata2mat - Convert xpcdata format to individual workspace variables
% -------------------------------------------------------------------------
% Abstract: This function converts the xpcdata structure format to MATLAB
% workspace variables.  Each signal will be saved as a variable in the base
% workspace named in the format 'signame_sc1', where 1 is the xpc scope
% number.
%
% Syntax:
%       xpcdata2vars(xpcdata)
%
% Inputs:
%           xpcdata - xpcdata structure generated from getxpcFileData.m
%
% Outputs:
%           none
%
% Examples:
%           none
%
% Notes: none
%

% Copyright 2007 - 2009 The MathWorks, Inc.
%
% Auth/Revision:
%   The MathWorks Consulting Group
%   $Author: rjackey $
%   $Revision: 10 $  $Date: 2007-07-26 15:56:29 -0400 (Thu, 26 Jul 2007) $
% -------------------------------------------------------------------------

% Get a list of signal names, and add 'time'
SigNames = [{'time'},xpcdata.signals];

% Loop through each signal in the xpcdata structure
for i=1:length(SigNames)

    % Prefix the variable name
    VarName = [SigNames{i}, '_sc', xpcdata.scopeno];

    % Get the data
    Data = xpcdata.(SigNames{i});

    % Assign the data in the base
    assignin('base',VarName,Data);

end

Contact us at files@mathworks.com