JSLスクリプトこんにちは、みんな、
私はJMPにまったく慣れておらず、JSLスクリプトを作成しており、ケースのロジックを構築するのに助けが必要でした。
ステータスとして列の1つを持つテーブルがあり、その中の1の数を数えたいのですが。最初の「1」を検出するとカウントを開始し、最後までカウントを続け、最後に1が発生した時点で最終カウントを出力します。そして、次の行に「0」が表示されると、カウンターを再度リセットして「1」の検索を開始します。

これを手伝ってくれたら本当にありがたいです。
アビ
Re:JSLスクリプトこれを行うことができます
Names default to here(1);
m = [0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0];
dt = new table("Test",
<< New Column("Status", <<SET values=""></SET>Re:JSLスクリプトnames default to here(1);
// create the table
m = [0,0,0,0,0,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,0,0,0];
dt = new table("Test",
new column("Status", set values(m));
);
// create the empty status column
dt << new column("Output");
// iterate over each row of the table
result = 0; // counter for consecutive 1's
for (i=1,i<=nrows(dt),i++,
// apply the logic the way
// that you would think it
value = dt:Status[i]; // i'th row of Status column table referenced by dt
if (value==0,
dt:Output[i] = 0;
result = 0;
,
result = result + 1;
dt:Output[i] = result;
)
);Re:JSLスクリプトお手伝いありがとう。ロジックは非常にシンプルでわかりやすく、非常に役立ちます。再度、感謝します。