how to display in one variable the max of each one of two arrays?

2 次查看(过去 30 天)
a=[5 10 15]
b=[20 25 30]
c= ?

采纳的回答

James Tursa
James Tursa 2016-9-17
c = [max(a) max(b)];

更多回答(1 个)

Star Strider
Star Strider 2016-9-17
Concatenate the vectors inside the max function call:
a = [5 10 15];
b = [20 25 30];
c = max([a; b], [], 2)
c =
15
30

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by