True false results to be saved as a value
Show older comments
I have a vector, a = [1,0,1,1,1,0,0,0......]
I want to say that when a is true, or when the elements in a are equal 1, to make another vector correspond.
So if I wanted the true elements to correspond as .25, how can I make another vector that reads: b = [.25,0,.25,.25,.25,0,0,0.....,]?
I was thinking something along the lines below.
a = zeros(1,10)
b = zeros(size(a))
while a == 1
b = .25
end
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!