Convert matrix A to S

Hello,
I try to convert ths matrix (called A)
A = [5 8 3; 1 2 3; 2 4 6]
to a matrix called S, using this code
S =
1 2
5 8
9 10
S=[A(1,1:2); A(2:3,1).'; 9 10]
This is not qute right
Any ideas? Thank you

1 件のコメント

Stephan
Stephan 2019 年 10 月 20 日
編集済み: Stephan 2019 年 10 月 20 日
Did you notice that you can accept and/or vote for useful answers?

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

回答 (1 件)

Stephan
Stephan 2019 年 10 月 20 日

0 投票

S=[A(2,1:2); A(1,1:2); 9 10]

6 件のコメント

SuzieChan
SuzieChan 2019 年 10 月 20 日
編集済み: SuzieChan 2019 年 10 月 20 日
Thanks.
This is matrix Z
Z = [7 6 8; 8 9 10; 7 3 2; 3 0 2]
What code to convert Z to S?
S =
1 2
5 8
9 10
S=[Z(3, 1:2); Z(1:2); 9 10]
This is wrong code.
There is no 5 in Z?
How possible?
Help please :)
Stephan
Stephan 2019 年 10 月 20 日
  • Please dont accidently delete your questions by editing them ;-) - use the comment function please.
  • Also please accept useful answers.
regarding your problem:
In the middle section you look at matrix B not Z:
S=[Z(3, 1:2); B(1:2); 9 10]
Perhaps it would be easier to help if you tell us more background of your problem - the conversion you are trying to do dont give much sense for me at the moment. What is the reason and the background? Please clarify.
SuzieChan
SuzieChan 2019 年 10 月 20 日
I changed B to Z (it was mistake).
I want to convert matrix Z to matrix S using the code starting S = ...
Stephan
Stephan 2019 年 10 月 20 日
What are the rules for converting?
Z =
7 6 8
8 9 10
7 3 2
3 0 2
S =
1 2
5 8
9 10
There is no pattern visible - at least for me. I dont see a 1, i dont see a 5 - so how are the rules? PLEASE give us some background information....
SuzieChan
SuzieChan 2019 年 10 月 20 日
編集済み: SuzieChan 2019 年 10 月 20 日
I see all numbers in Z except 1 and 5.
So is possible to insert 1 and 5 into new code, S?
Where do I place them?
example..
S=[1 5; Z(1:2); Z(1:2)]
something like
S=[1; Z(1:2); 5; Z(1:2)]
to manually put 1 and 5 in new matrix S
how?
Stephan
Stephan 2019 年 10 月 20 日
>> S = [1 Z(3,3); 5 Z(2,1); Z(2,2:end)]
S =
1 2
5 8
9 10

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

カテゴリ

タグ

質問済み:

2019 年 10 月 20 日

コメント済み:

2019 年 10 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by