Introduction to Matlab Coursera Minimum and Maximum Assignment

4 ビュー (過去 30 日間)
Jacob
Jacob 2024 年 6 月 25 日
コメント済み: Umar 2024 年 6 月 26 日
Having some trouble with this assignment.
Write a function called minimax that takes M, a matrix input argument and returns mmr, a row vector containing the absolute values of the difference between the maximum and minimum valued elements in each row. As a second output argument called mmm, it provides the difference between the maximum and minimum element in the entire matrix. See the code below for an example:
>> A = randi(100,3,4)
A =
66 94 75 18
4 68 40 71
85 76 66 4
>> [x, y] = minimax(A)
x =
76 67 81
y =
90
%Code to call your function
[mmr, mmm] = minimax([1:4;5:8;9:12])
  5 件のコメント
Jacob
Jacob 2024 年 6 月 26 日
編集済み: Jacob 2024 年 6 月 26 日
Thanks, that makes a lot more sense. But the max_per_row and min_per_row will have to be the prime version, right? Since the question asks for a row vector and "max" and "min" return a column vector.
Umar
Umar 2024 年 6 月 26 日
Hi Jacob, To address your concern about `max_per_row` and `min_per_row` being column vectors instead of row vectors, you are correct in pointing out that the current implementation returns column vectors. To ensure that these values are row vectors as per the requirement, you can transpose them to convert from column vectors to row vectors.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by