フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

hi friends. we have a vectore v= [ 1 2 6 7 8 9], I want to compute: 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 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
lambda = lambda_uncoup; mue_prior = mue_0; mue_prior = mue_prior([1;parents+1],1); else lambda = lambda_coup; end

回答 (1 件)

Sebastian Castro
Sebastian Castro 2015 年 7 月 30 日
I'd recommend looking at this page, which discusses many different ways to search through vectors and matrices based on some condition:
Also, here is a simple example. Suppose you want to perform a calculation if the vector contains the value "4" somewhere:
v = [1 2 3 4];
if any(v==4)
disp('Found a 4!')
end
- Sebastian

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by