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
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
Rik 2020 年 8 月 17 日
@Anand, did you see my answer below? It contains a hint about how you can do this.

サインインしてコメントする。

 採用された回答

Rik
Rik 2020 年 5 月 21 日

0 投票

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 件のコメント

chad asdal
chad asdal 2020 年 5 月 22 日
Thanks I will have to fiddle with that I was trying to use END but could not get it to work
I will go back and review the material and see if i can combine you example with information with it.

サインインしてコメントする。

その他の回答 (1 件)

urvashi sharma
urvashi sharma 2020 年 10 月 19 日

0 投票

1 件のコメント

Rik
Rik 2020 年 10 月 19 日
Why did you post this? Is this a question? An answer?
If you don't respond, this may be deleted.

サインインしてコメントする。

カテゴリ

製品

質問済み:

2020 年 5 月 21 日

コメント済み:

Rik
2020 年 10 月 19 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by