関数win_eraseDifferentSamplingRateData マニュアル

(The documentation of function win_eraseDifferentSamplingRateData)

Last Update: 2025/6/12


◆機能・用途(Purpose)

WINデータから先頭時刻とサンプリングレートが異なるチャンネルブロックを削除する。
Remove channel blocks that have a sampling rate different from that of the beginning time from a WIN data.


◆形式(Format)

#include <win/convert.h>
inline void win_eraseDifferentSamplingRateData
(const int NsecondBlock,struct win_secondBlock ∗winData,
 const struct win_channelTable channelTable)


◆引数(Arguments)

NsecondBlock 秒ブロックの個数。 関数orderWinData に第2引数として渡して値を設定したものを渡すこと。 関数win_countSecondBlock の戻り値をそのまま渡してはならない。
The number of second blocks. This value must be determined from the 2nd argument of function orderWinData, NOT from the return value of function win_countSecondBlock.
winData 関数orderWinData を用いて作成した、時刻順に並び秒ブロックに欠損・重複が無いWINデータ (秒ブロックのデータを並べた配列)を与える。 各配列要素は1つの秒ブロックのデータを表す構造体であり、 そのメンバchannelBlockにはチャンネルブロックのデータを並べた配列が格納されている。 この関数内では各チャンネルブロックのサンプリングレートが 同じチャンネルの最初の時刻のデータにおけるサンプリングレートと 一致するか否かのチェックが行われ、 一致しない場合はそのチャンネルブロックのデータが ダミーデータで置換される。
A WIN data (an array composed of the data of second blocks) created by function orderWinData, which is sorted in time order without defects nor duplication of second blocks. Each array component represents the data for each second block, which is a structure. The member channelBlock of this structure is an array composed of the data of channel blocks. Within this function, the sampling rate of each channel block is checked if it is equal to the sampling rate of the same channel in the first time period; if the sampling rates are not equal, the data in this channel block is replaced by a dummy data.
channelTable チャンネルテーブルのデータ。 関数sortWinData に第3引数として渡したものと同じデータを用いること。
A channel table data equivalent to what was used for the 3rd argument of function sortWinData.


◆動作(Behaviour)

引数winDataの各配列要素(秒ブロックのデータ)は構造体であり、 そのメンバchannelBlockはチャンネルブロックのデータを並べた配列である。 その配列を構成する個々のチャンネルブロックのサンプリングレート (struct win_channelBlock型構造体のメンバsamplingRateの値)が、 前の時刻の秒ブロックにおける同じチャンネルのサンプリングレートと一致するか否かをチェックし、 一致しない場合はこのチャンネルブロック(後の時刻のもの)をダミーデータで置き換える。 実際の処理としてはstruct win_channelBlock型構造体のメンバsizeの値を 0に変更することにより、そのチャンネルブロックが欠損として扱われるようにする。
Each array component of argument winData is a structure that represents the data of a second block. The member channelBlock of this structure is an array composed of the data of channel blocks. This function checks if the sampling rate of each channel block of this array (the value of member samplingRate of a struct win_channelBlock-type structure) is equal to the sampling rate of the same channel in previous second blocks; if they are not equal, this channel block (for the later time period) is replaced by a dummy data. In practice, the dummy data is created by changing the value of member size of a struct win_channelBlock-type structure to 0. After this update, this channel block is treated as a defect.


◆使用例(Example)

int NsecondBlock_before =win_countSecondBlock("data.win");

struct win_data winData_before =read_win_file("data.win");

struct win_channelCodeList channels =win_readChannelCode("channel_codes.txt");

struct win_channelTable channelTable_all =win_readChannelTable("channels.tbl");

struct win_channelTable channelTable_use =win_selectChannelTable(channelTable_all,channels);

sortWinData (NsecondBlock_before, winData_before, channelTable_use);

int NsecondBlock_before_after;

struct win_secondBlock winData_after =orderWinData (NsecondBlock_before, &NsecondBlock_after, winData_before);

win_eraseDifferentSamplingRateData (NsecondBlock_after, winData_after, channelTable_use);


◆使用上の注意(Note)

この関数はチェック機能が十分でなく、 正しく用いないと間違ったデータが何の警告も無しに生成されてしまう恐れがある。 特に以下の点に留意して用いること。
This function does not carefully check the input data. Therefore, if this function is used with a wrong manner, the result may be wrong data without warning. To avoid this scenario, pay attention especially to the points below.