フィルターのクリア

hi, everyone, we have a vectore v= [ 1 2 6 7 8 9], I want to compute the following : if variable component=1:10 is equal to one component of v then do some calculation like below. how can I do that:

1 回表示 (過去 30 日間)
M Shaka
M Shaka 2015 年 7 月 30 日
コメント済み: Image Analyst 2015 年 7 月 30 日
if(........)%%%% what should I write inside if lambda = lambda_uncoup; mue_prior = mue_0; mue_prior = mue_prior([1;parents+1],1); % #predx1
else
lambda = lambda_coup;
end
  1 件のコメント
Image Analyst
Image Analyst 2015 年 7 月 30 日
How can an array of 6 elements be "one component" of another array? What does that even mean???? It would only make sense to me if v was a cell array and one of the cells would have that same 6 element vector inside it. It does not make sense to me if v is a regular, ordinary vector.

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

回答 (1 件)

Star Strider
Star Strider 2015 年 7 月 30 日
I don’t know exactly what you want to do. See if this does what you want:
v = [ 1 2 6 7 8 9];
variable_component = 1:10;
if intersect(v, variable_component)
fprintf('\n\t\tDo something!\n')
end

カテゴリ

Help Center および File ExchangePerformance and Memory についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by