How would I randomly pick one point from N points in MATLAB?

前端 未结 3 1082
自闭症患者
自闭症患者 2020-12-21 13:24

I use this code to create and plot N points:

N = input(\'No. of Nodes:\');
data = rand(N,2); % Randomly generated n no. of nodes
x = data(:,1);
         


        
3条回答
  •  南笙
    南笙 (楼主)
    2020-12-21 14:12

    Just take the first one. Being a product of the rand()-function, it should be random enough for anybody :-)

    plot(x(1),y(1),'o');

提交回复
热议问题