[OUT] calib_data : calibration data (gain, offset) for each channel [IN] fid : file id required_channel: Required channel (in vector format, starts with 0) You can choose [Inf] for all channel selection. e.g. [0, 1, 10, 100] -> ch0,1,10,100 will be loaded e.g. none -> all channel Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [calib_data] = vb_read_yokogawa_calib_data(fid, required_channel); 0002 % [OUT] 0003 % calib_data : calibration data (gain, offset) for each channel 0004 % [IN] 0005 % fid : file id 0006 % required_channel: Required channel (in vector format, starts with 0) 0007 % You can choose [Inf] for all channel selection. 0008 % e.g. [0, 1, 10, 100] -> ch0,1,10,100 will be loaded 0009 % e.g. none -> all channel 0010 % 0011 % Copyright (C) 2011, ATR All Rights Reserved. 0012 % License : New BSD License(see VBMEG_LICENSE.txt) 0013 0014 %%% チャンネル設定 %%% 0015 channel_count = GetMeg160ChannelCountM( fid ); 0016 ch_vec = []; 0017 if ~isexist(required_channel) 0018 ch_vec = 0:(channel_count-1); 0019 else 0020 ch_vec = required_channel; 0021 end 0022 ch_vec_index = ch_vec + 1; 0023 0024 calib_info = GetMeg160CalibInfoM( fid ); 0025 % (m x 3) matrix of calibration information. (m: channel_count) 0026 % 1 : channel number in Meg160(zero start) 0027 % 2 : gain [Tesla/V] 0028 % 3 : offset voltage [V] 0029 selected_calib_info = calib_info(ch_vec_index, :); 0030 for no = 1:length(ch_vec) 0031 data_gain = selected_calib_info(no, 2); 0032 data_offset = selected_calib_info(no, 3); 0033 calib_data(no) = struct('offset', data_offset, 'gain', data_gain ); 0034 end 0035