intro to programing MATLAB, Matrix
3 次查看(过去 30 天)
显示 更早的评论
Hello everyone I just finished a assignment and was wondering if there was a easier answer then i got the question was
Given matrix A assign the second column to a variable v. after change elements of last row to 0
A=[1:5; 6:10; 11:15; 16:20];
i used
v = A(1:4,2)
A= [1:5; 6:10; 11:15; 0,0,0,0,0]]
the answer is correct but how could i have made it simpler? Recomendations?
2 个评论
Anand Shanker Trivedi
2020-8-17
can you please tell me how u got answer for this assisngment
i am stuck in this since 2 days but could not find answer
what should be the value of v ?
采纳的回答
Rik
2020-5-21
You can use the colon to index all values in a dimension:
IMG(2,2,:)=[100 255 255];%assign RGB values to a pixel
You can also use the end keyword to index into the last element of a dimension:
Blue=IMG(:,:,end);
I'm not giving more specific instructions, because that would encourage you to cheat.
更多回答(1 个)
urvashi sharma
2020-10-19
1 个评论
Rik
2020-10-19
Why did you post this? Is this a question? An answer?
If you don't respond, this may be deleted.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!