Info

此问题已关闭。 请重新打开它进行编辑或回答。

How to vectorize given matlab code?

1 次查看(过去 30 天)
reshdev
reshdev 2014-9-5
关闭: reshdev 2014-11-13
Hello,
i am new to matlab. can anyone please vectorize this code.
Thanks
for row=1:n
for col =1:n
Fn(row,col)= cost(row,col)*W(row,col);
if W(row,col)>0
Fn(row,col) = Fn(row,col)+FC(row,col);
end
end
end
  1 个评论
Stephen23
Stephen23 2014-9-5
编辑:Stephen23 2014-9-5
Answer: yes, YOU can.
  1. Read the documentation about vectorization .
  2. Look at some examples online.
  3. Try writing your own solution, perhaps on a simplified test case first.
  4. Don't expect other people to write your code for you.
  5. Write a question here when you have a specific problem to be fixed.

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by