withtol
timetable の行の添字における時間の許容誤差
説明
S = withtol(
は、timetable の行を選択するための添字を作成します。rowTimes
,tol
)S
は、tol
に指定された許容誤差内で、行時間が rowTimes
の時間に一致するすべての行を選択します。rowTimes
引数は、datetime 配列、duration 配列または日付と時刻を指定する文字ベクトルの cell 配列です。tol
は duration 値でなければなりません。
rowTimes
に datetime 値が含まれる場合は、S
のみを使用して、行時間が datetime 値である timetable に添字を付加できます。同様に、rowTimes
に duration 値が含まれる場合は、S
のみを使用して、行時間が duration 値である timetable に添字を付加できます。
例
行時間と一致させるための許容誤差の指定
時間単位の行時間とともに、温度と圧力のデータを含む timetable を作成します。行時間には、わずかにランダムな分散があります。時間ベクトル内の対応する時間と 5 秒の許容誤差内で一致する行時間をもつ行を選択します。
Time = datetime(2015,12,18) + hours(1:10)' + seconds(randn(10,1)); Temp = [37.3 39.1 42.3 42.6 43 43.9 44.1 43.3 42.5 42]'; Pressure = [29.4 29.6 30.0 30.0 30.1 29.9 29.9 29.8 29.6 29.7]'; TT = timetable(Time,Temp,Pressure)
TT=10×2 timetable
Time Temp Pressure
____________________ ____ ________
18-Dec-2015 01:00:00 37.3 29.4
18-Dec-2015 02:00:01 39.1 29.6
18-Dec-2015 02:59:57 42.3 30
18-Dec-2015 04:00:00 42.6 30
18-Dec-2015 05:00:00 43 30.1
18-Dec-2015 05:59:58 43.9 29.9
18-Dec-2015 06:59:59 44.1 29.9
18-Dec-2015 08:00:00 43.3 29.8
18-Dec-2015 09:00:03 42.5 29.6
18-Dec-2015 10:00:02 42 29.7
3:00 から 8:00 までの時間にまたがる時間ベクトルを作成します。
newTimes = datetime(2015,12,18) + hours(3:8)
newTimes = 1x6 datetime
Columns 1 through 3
18-Dec-2015 03:00:00 18-Dec-2015 04:00:00 18-Dec-2015 05:00:00
Columns 4 through 6
18-Dec-2015 06:00:00 18-Dec-2015 07:00:00 18-Dec-2015 08:00:00
newTimes
の時間と 5 秒の範囲内で一致する行時間をもつ TT
の行を選択します。
S = withtol(newTimes,seconds(5)); TT2 = TT(S,:)
TT2=6×2 timetable
Time Temp Pressure
____________________ ____ ________
18-Dec-2015 02:59:57 42.3 30
18-Dec-2015 04:00:00 42.6 30
18-Dec-2015 05:00:00 43 30.1
18-Dec-2015 05:59:58 43.9 29.9
18-Dec-2015 06:59:59 44.1 29.9
18-Dec-2015 08:00:00 43.3 29.8
入力引数
rowTimes
— timetable 内で一致させる時間
datetime 配列 | duration 配列 | 文字ベクトルの cell 配列 | string 配列
timetable 内で一致させる時間。datetime 配列、duration 配列、文字ベクトルの cell 配列、または string 配列として指定します。rowTimes
には、timetable の行時間と正確には一致しない、しかし指定した許容誤差内である可能性をもつ時間が含まれます。
rowTimes
が文字ベクトルの cell 配列または string 配列である場合、その配列の要素が、関数 datetime
または関数 duration
で変換できる日付と時刻を指定します。
tol
— 時間を timetable の行時間と一致させるための許容誤差
duration | 文字ベクトル | string スカラー
時間を timetable の行時間と一致させるための許容誤差。duration、文字ベクトル、または string スカラーとして指定します。
tol
が文字ベクトルまたは string スカラーである場合は、tol
は関数 duration
で変換できる時間を指定します。
拡張機能
C/C++ コード生成
MATLAB® Coder™ を使用して C および C++ コードを生成します。
バージョン履歴
R2016b で導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)