I have to use a loop to flip the value of p between 0 and 1 and each time it has to be different in a single line of code.
No products are associated with this question.
Is this what you're looking for?
p=0; for k = 1 : 5 % Here's the iterative loop it requested clc; % Here's the single line p = ~p pause(1); end fprintf('Done with demo!\n');
your_vector=mod(0:1000,2); % single line code
% YOUR CODE fprintf('%d\n',your_vector(i)) pause(0.3) end