Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Accessing random elements from matrix

Accessing random elements from matrix

Accessing random elements from matrix

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.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close