Hi Nicolo,
Setting the time vector accordingly directly gives you a square wave, if you want to visualize it you can use the stairs function
The following is an example,
A = [0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1];
ts = 10e-10; % Sampling Time based on your frequency
t = 0:ts:((length(A)-1)*ts); % Time Vector
s = stairs(t,A); % Plotting
