from pylab import *# define some gridsxgrid = arange(20, 31) ygrid = arange(10, 16)xscan = []yscan = []for i, yi in enumerate(ygrid): xscan.append(xgrid[::(-1)**i]) # reverse when i is odd yscan.append(ones_like(xgrid) * yi) # squeeze lists together to vectorsxscan = concatenate(xscan)yscan = concatenate(yscan)# quick plotplot(xscan, yscan, '.-')axis([19, 31, 9, 16])show()
MATLAB: How can this Python code be written in Matlab? I’m trying to write a Matlab script that will allow two Stepper motors to scan in a Raster pattern but all I can find is this Python script. How the ‘for’ loop be replicated in Matlab
matlab python raster pattern
Best Answer