二つの数字の引き算

3 views (last 30 days)
海
on 24 Oct 2022
Edited: Atsushi Ueno on 24 Oct 2022
写真のように、数字が2秒ごとに列に並んでいるのですが、全ての列を引き算するプログラミングは作れるでしょうか?
例えば、写真でいうと(35.01-33.69)、(35.24-33.91)、(35.55-33.92).......のように全ての列を引き算したいです。

Answers (1)

Atsushi Ueno
Atsushi Ueno on 24 Oct 2022
Edited: Atsushi Ueno on 24 Oct 2022
TT = {datetime(2022,10,24,12,06,29), 33.69, 33.91, 33.92, 33.29; % 6列目以降は省略
datetime(2022,10,24,12,06,30), 35.01, 35.24, 35.55, 34.72}
TT = 2×5 cell array
{[24-Oct-2022 12:06:29]} {[33.6900]} {[33.9100]} {[33.9200]} {[33.2900]} {[24-Oct-2022 12:06:30]} {[35.0100]} {[35.2400]} {[35.5500]} {[34.7200]}
diff = cellfun(@minus,TT(2,:),TT(1,:),'uni',false) % 2行目から1行目を引く
diff = 1×5 cell array
{[00:00:01]} {[1.3200]} {[1.3300]} {[1.6300]} {[1.4300]}

Categories

Find more on MATLAB 入門 in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!