フィルターのクリア

Multiple if loops with warning message variable appears to change size with every iteration

1 回表示 (過去 30 日間)
Mau Dudas
Mau Dudas 2019 年 11 月 18 日
I am aware this might not be the only problem with the code but I honestly can't think of anything else.
Other than the fact that it keeps saying the matrix for the index is not compatible...
So if anyone can help in time I will be eternally greatful
function mymodel(x1,x2)
x1=3;
x2=5;
for i =[x1,x2]
if (x1>0 && x2>0)
mymodel(i)=(x1\x2)
elseif (x1>0||x2>0)
mymodel(i)= 2.*(x1\x2)
if (x1<0 && x2<0)
mymodel(i)= (x2\x1)
else mymodel(i) = 0
end
Obviously it needs to compute a different variable for each iteration.
It does not seem to want to compute negative numbers at all. Which I would need.
Helps pls!

回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by