please explain this error

조회 수: 5 (최근 30일)
dav
dav 2014년 10월 2일
답변: Deeptanu Datta 2019년 12월 25일
I'm using matlab 2012a.
When I tried the following command it gave me an error.
Can you please explain it to me?
Thanks
Command:
max(-3/2, 7, 1.4)
Error using max
MAX with two matrices to compare and a working dimension is not supported.

채택된 답변

Mischa Kim
Mischa Kim 2014년 10월 2일
편집: Mischa Kim 2014년 10월 2일
dav, I believe what you are trying to do is the following
max([-3/2, 7, 1.4])
The values you want to find the maximum of need to be arranged in arrary form, that's why the square brackets.
  댓글 수: 1
dav
dav 2014년 10월 2일
yep, I figured it out after a while. :) Thank you very much!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Deeptanu Datta
Deeptanu Datta 2019년 12월 25일
I tried running the code
clc;
clear all;
close all;
x1 = [2 3 6 9 7 4 1 5 9 36 47 25 ];
[~, x3] = max(x1,[])
It gives an error "MAX with two matrices to compare and two output arguments is not supported"
But, when I write [~, x3] = max(x1,[],2) or [~, x3] = max(x1), it works.
Please explain

카테고리

Help CenterFile Exchange에서 Parallel Computing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by