assign op values from matrix
1 view (last 30 days)
Show older comments
Hi all
Is there a way to assign for loop values from the matrix
for e.g. for i = x:y, here the value of x and y needs to be assigned rom the values present in the matrix, lets say A.. Is there a way to do this ??
0 Comments
Accepted Answer
Walter Roberson
on 23 Jan 2021
Sure.
x = randi([0 1], 1, 50);
disp(char('0'+x))
locs = find(x)
for i = locs(13) : locs(17)-1
fprintf('x(%d) = %d\n', i, x(i));
end
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!