フィルターのクリア

for loop with if statement update double

1 回表示 (過去 30 日間)
Tomasz Kaczmarski
Tomasz Kaczmarski 2020 年 4 月 11 日
コメント済み: Tomasz Kaczmarski 2020 年 4 月 13 日
im doing simple loop as below unfortunetly its not working as expected
my expected output is when t=4 then yscore 1 else yscore 0
expected yscore = [0,0,0,1,0,0,0,0,0,1,0,0]
can somone please help me where i make mistake ?
close all; clear all; clc;
t = [1,2,3,4,5,6,1,2,3,4,5,6]
%yscore = [0,0,0,1,0,0,0,0,0,1,0,0]
nrows = 1;
ncols = 12;
A = t(nrows,ncols);
for c = 1:ncols
for r = 1:nrows
if A == 4
yscore(1:ncols) = 1
else
yscore(1:ncols) = 0
end
end
end

採用された回答

darova
darova 2020 年 4 月 11 日
Try this approach
  1 件のコメント
Tomasz Kaczmarski
Tomasz Kaczmarski 2020 年 4 月 13 日
thanks !

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by