Please suggest a method using Vectorization.
Show older comments
I want to do the following operation using vectorization technique of Matlab. I am a novice user of matlab. So please tell me how i can get the following operation done without using the FOR Loop.
x=[1 2 3 4 5 6 7 8 9 10 11 1 2];
for i=1:length(x)
x(i)=((-1)^i)*x(i);
end
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Identification in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!