MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayNew to MATLAB?
MATLAB Central > MATLAB Newsreader > Vectorised approach to fill the array 

Subject: Vectorised approach to fill the array From: Liana Date: 19 Apr, 2011 08:21:04 Message: 1 of 7 
Hello, 
Subject: Vectorised approach to fill the array From: Matt J Date: 19 Apr, 2011 11:08:04 Message: 2 of 7 
"Liana" wrote in message <iojglg$p5f$1@fred.mathworks.com>... 
Subject: Vectorised approach to fill the array From: Liana Date: 20 Apr, 2011 06:47:04 Message: 3 of 7 
Thank you. I've almost solved the problem using repmat and reshape. However, I've got another problem, for which I opened a new thread, 'cause its quite specific. 
Subject: Vectorised approach to fill the array From: Abhinav Gaur Date: 20 Apr, 2011 13:30:20 Message: 4 of 7 
"Liana" wrote in message <iolvh8$411$1@fred.mathworks.com>... 
Subject: Vectorised approach to fill the array From: Abhinav Gaur Date: 20 Apr, 2011 13:40:05 Message: 5 of 7 
"Liana" wrote in message <iolvh8$411$1@fred.mathworks.com>... 
Subject: Vectorised approach to fill the array From: Liana Date: 20 Apr, 2011 19:28:05 Message: 6 of 7 
Thanks, Abhinav! It works perfectly. However, I also want to finish my variant to compare the execution time. In my variant, I transformed all the data into two vectors of indices, e.g. points = [1; 1; 3; 5; 5]; and neighbours = [2; 4; 5; 8; 9]. And each pair, e.g. points(1) x neighbours(1), corresponds to the cell in matrix ANS, which must be equal to 1. As I noticed, I cannot run ANS(points,neighbours)=1. Do I need to linearize these indices? Thanks. 
Subject: Vectorised approach to fill the array From: Liana Date: 20 Apr, 2011 19:37:04 Message: 7 of 7 
Ok, I solved it: 
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.