91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

matlab讀取comtrade文件支持文本與二進制

資源截圖

代碼片段和文件信息

function?read_comtrade
%讀取文本與二進制
%%?Comtrade?Reader?function
%?
%?This?file?is?designed?to?decode?the?data?stored?in?COMTRADE?format?
%?as?defined?in?IEEE?C37.111-1999.?This?involves?the?opening?of?two?files?
%?one?containing?the?configuration?(.cfg)?information?and?the?other?
%?the?data?(.dat).
%?
%?COMTRADE?provides?a?common?format?for?the?data?files?and?exchange?medium?
%?needed?for?the?interchange?of?various?types?of?fault?test?or?simulation?
%?data.

%%?open?the?comtrade?files?&?extract?the?data

%?read_comtrade(filename)
%??Imports?data?from?the?specified?file
%??filename:??files?to?read?.cfg?and?.dat

%??Auto-generated?by?MATLAB?on?12-Jul-2007?13:45:45

%?Use?the?uigetfile?function?to?load?the?.cfg?file?which?is?then?used?to
%?load?the?associated?.dat?file

%?First?get?the?.cfg?file?information
[CfgFileNamePath]?=?uigetfile(‘*.cfg‘);%載入.CFG文件
PathAndCfgName?=[Path?CfgFileName];?%PathAndCfgName?=路徑\文件名.cfg??eg.?PathAndCfgName?=E:\研究生\項目\READE_comtrade\262-RCS902A.cfg

%?Derive?the?.dat?file?string
%DatFileName?=?strcat(sscanf(CfgFileName‘%1s‘length(CfgFileName)-4)?‘.dat‘);
DatFileName?=?[CfgFileName(:1:length(CfgFileName)-4)?‘.dat‘];%dat文件名
PathAndDatName?=[Path?DatFileName];%dat路徑加文件名

%?Store?the?file?name?(minus?extension)?and?path?in?the?workspace
assignin(‘base‘‘Path‘?Path);
assignin(‘base‘‘FileName‘?sscanf(CfgFileName‘%1s‘length(CfgFileName)-4));

%?Now?open?the?.cfg?and?.dat?files
cfg_id?=?fopen(PathAndCfgName);

%?Scan?the?text?into?local?cells?cfg?and?dat.
cfg?=?textscan(cfg_id?‘%s‘?‘delimiter‘?‘\n‘);

%?close?all?open?files?as?we‘re?done?with?them?now.
fclose(cfg_id);

%%?start?to?decode?the?data

cfg_len?=?length(cfg{11});
cfg_string?=?cell(size(cfg));

for?i?=?1:cfg_len
????temp_string?=?char(cfg{11}{i});
????cfg_string{i}?=??strread(temp_string?‘%s‘?‘delimiter‘?‘‘)‘;
end

%?Comtrade?File?Identifier
title?=?char(cfg_string{11}(1));

%?Comtrade?Version
if?length(cfg_string{11})?
????Version?=?‘1999‘;
else
????Version?=?char(cfg_string{11}(3));
end

%?Channel?information:?total?analogues?and?digitals
No_Ch?=?strread(char(cfg_string{12}(1)));%總通道數量
Ana_Ch?=?strread(char(cfg_string{12}(2)));%模擬量量通道數
Dig_Ch?=?strread(char(cfg_string{12}(3)));%數字量通道數

%?Nominal?frequency?
frequency?=?strread(char(cfg_string{13+No_Ch}(1)));

rates?=?strread(char(cfg_string{14+No_Ch}(1)));
No_Ch?=No_Ch+rates-1;
%?Sampli

評論

共有 條評論