48 lines
1.8 KiB
Matlab
48 lines
1.8 KiB
Matlab
function [Data,params] = load_matlab(path)
|
||
%LOAD_MATLAB imports EPR data recorded with MATLAB script
|
||
% Usage: ['data_as_double','struct_with_parameters'] = load_matlab('C:/full/path/to/file.mat')
|
||
%
|
||
% Imports data exported from MATLAB workspace and extracts the filename.
|
||
% Input has to be the full path to file with forwardslashes as char or
|
||
% string. The extracted name is appended to the 'params' struct, whos
|
||
% contents are displayed in the command window afterwards.
|
||
%
|
||
% Example for params output:
|
||
% params =
|
||
%
|
||
% struct with fields: Units
|
||
%
|
||
% Field_Center: 3500 G
|
||
% Field_Sweep: 2700 G
|
||
% Field_Step: 5 G
|
||
% Accumulations: 100 -
|
||
% laser_shotreprate: 20 -
|
||
% Field_Start: 2150 G
|
||
% Field_End: 4850 G
|
||
% Field_Vector: [1×540 double] G
|
||
% mwFreq: 9.6845 GHz
|
||
% mwPower: 0.2000 W
|
||
% QValue: 22800 -
|
||
% mwAtten: 30 dB
|
||
% mwFreqs: [681×1 double] GHz
|
||
% TimeBase: [1×10001 double] s
|
||
% Path: '/some/path/' -
|
||
% Name: 'example_data' -
|
||
|
||
%correct \ for /
|
||
corrpath = replace(path,"\","/");
|
||
|
||
%load data and write TimeBase in params
|
||
load(corrpath,'Data','params','TimeBase')
|
||
params.TimeBase = TimeBase;
|
||
|
||
%get filename for further documentation and exporting figures
|
||
[datapath,dataname,~] = fileparts(corrpath);
|
||
params.Path = datapath;
|
||
params.Name = dataname;
|
||
|
||
%echo what information is contained in the structure called 'params'
|
||
params
|
||
end
|
||
|