Adding 1 to a random element in a matrix
1 view (last 30 days)
Show older comments
Hey all,
I need to add 1 to a random number in a matrix, and show which column/row this addition as been made, while making it return back to the original matrix
Ex.
>> a=zeros(2)
a =
0 0
0 0
>> aa=additional(a)
aa =
1 0
0 0
>> [aaa row/column] =additional(aa)
aaa =
2 0
0 0
row/column =
1 1
etc.
Thanks!
1 Comment
Image Analyst
on 25 Jan 2015
Edited: Image Analyst
on 25 Jan 2015
Is this homework? It looks like your classmate has already posted it and was honest enough to label it as homework. His question is here. What do you need beyond the ints he got? You have not actually asked any question yet, so there is nothing for me to answer. But it sounds a lot like homework so I'll let you code it up a bit more and then ask any questions that you might have.
By the way, you can't have a variable name with the division operator / in the name.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!