Find max, min and create array C
1 次查看(过去 30 天)
显示 更早的评论
A = [-2 2 3 1 6 4;4 1 0 1 0 -2];
1. Find the maximum and minimum values in the last column
- Should use size() function but how find values in last column?
2. Create a 1X2 array C consisting of all elements in the first row and the last two columns of A.
6 个评论
Jan
2013-9-12
@Kondolik: The Getting Started chapters of the documentation explain the methods for indexing clearly and exhaustively. The forum is not the reight place to ask such very fundamental basics.
You are asked to extract the 2 elements from the first row and the last two columns. Therefore I do not see any problem when A has 10 elements.
回答(1 个)
Youssef Khmou
2013-9-11
you can start by creating a temporary variable B=A(:,end), next you can use max(B) and min(B) or you can use the function B=sort(B,'ascend') in ascending order , next the min is B(1) and the maximum is B(end)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!