【App designer】ある区間のデータから、該当する区間の回数を記録するアプリの作成について
Show older comments
下記のアプリを作成しています。
①下記のようなデータファイル(プログラム中 app.data)を読み込み
②データの1列目において、値が1以上立ち上がる前の位置から、
データの2列目において、値が1以上になる位置までの行数を計算
③データの全てにおいて、②を行い、平均の行数(プログラム中 ans)を算出(下記の場合、6.5行となる)

そこで、下記のようなプログラムを検討しています。
df = diff(app.data(:, 1));
idx = find(df >= 1, inf, 'first');
rows = zeros(1, numel(idx));
for n = 1:numel(idx)
checkFlag = find(app.data(idx(n):end, 2) >= 1, 1, 'first');
if isempty(checkFlag)
checkFlag = 0;
end
rows(1, n) = checkFlag;
end
ans = mean(rows)
上記に加え、該当する区間の回数をカウントするような処理を追加したいと考えています。
size関数などを使用することで、上記に追加する形で、修正は可能でしょうか。
よろしくお願いいたします。
Accepted Answer
More Answers (0)
Categories
Find more on Antennas, Microphones, and Sonar Transducers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!