Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing random elements from matrix

Status
Not open for further replies.

Shital84

Electrical
Oct 4, 2014
1
0
0
US
My problem is in MATLAB Simulink.

I have a matrix say "A" which is 5*6. Now the elements of this matrix is given by aij, where i is the row and j gives the column index. I have another matrix "B" of dimension 8*2 whose elements are given by bij. Now, I need to find an output A which is "Aout" which should be also of size 5*6. This "Aout" is formed from "A" in such a way that the the elements of "B" select the elements from "A" where bi1 gives the row index for "A" and bi2 gives column index for "B". The elements that are not indexed by "B" will be unchanged. The elements in "A" that are indexed by "B" will be changed randomly. I must implement this in MATLAB Simulink. What I have tried doing is: 1) Using "overwrite Values" allows me to change only consecutive rows/columns and not the selected ones. 2)Using "Direct LookUp Table", what I am getting is 8*1 vector instead of 5*6. Its giving me all the elements from "A" indexed by bij but not giving anything else.

Please give me a clue how can I get "Aout" of size 5*6.

Thanks.
 
Replies continue below

Recommended for you

Student posting is not allowed.

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529

Of course I can. I can do anything. I can do absolutely anything. I'm an expert!
 
Status
Not open for further replies.
Back
Top