combine two matrices to get another matrix of same size

1 次查看(过去 30 天)
I have two matrices of same order say 'a' and 'b':
a=[1,2;3,4];
b=[5,6;7,8];
How to combine these matrices in order to get a 3rd matrix of the form:
c=[15,26;37,48]
i.e. each cell of first matrix combine with corresponding cell of another matrix.

采纳的回答

madhan ravi
madhan ravi 2018-11-20
编辑:madhan ravi 2018-11-20
>> a=string([1,2;3,4]);
b=string([5,6;7,8]);
c=str2double(strcat(a,b))
c =
15 26
37 48
>>
  10 个评论
Walter Roberson
Walter Roberson 2020-1-23
That is not valid in MATLAB unless you switch to string. It is not possible to have a numeric entry that has a negative sign in the middle of it and have the negative preserved.

请先登录,再进行评论。

更多回答(1 个)

Bruno Luong
Bruno Luong 2018-11-20
>> a=[1,2;3,4];
>> b=[5,6;7,8];
>> a*10+b
ans =
15 26
37 48

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by