I am writing a Particle Swarm Optimization program and for that i want to initialize my particles. I want my particles to be initialized randomly from the column on which i am applying swarm optimization.
I am doing the program in Octave. I tried looking up for related commands but coundt find one. I want the answer in a matrix form.
Help is appreciated.
For Ex
733
590
495
479
569
560
305
433
319
244
256
255
398
340
from this i want 5 numbers like
305 590 495 244 340
Help is appreciated.
X = magic(10);
% pick k random numbers for column n:
k = 4;
n = 3;
X(randi(size(X,1), k, 1), n)