Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

where is the error ?

조회 수: 3 (최근 30일)
KHAIF HICHEM
KHAIF HICHEM 2018년 12월 2일
마감: MATLAB Answer Bot 2021년 8월 20일
function [ vmin ] = mini(vect)
%MINI retourne le minimum d’un vecteur
n = numel(vect);
if n == 0
vmin = [];
else
vmin = vect(1);
for k = 2:n
if vect(k) < vmin
vmin = vect(k);
end
end
end
end
function [ vmax ] = maxi(vect)
%MAXI retourne le maxiimum d’un vecteur
n = numel(vect);
if n == 0
vmax = [];
else
vmax = vect(1);
for k = 2:n
if vect(k) > vmax
vmax = vect(k);
end
end
end
end
  댓글 수: 8
Walter Roberson
Walter Roberson 2018년 12월 2일
defining the variable in the base workspace is not enough .you need to go to the command line and
mini(v)
KHAIF HICHEM
KHAIF HICHEM 2018년 12월 3일
can you show me ho to do ?

답변 (1개)

M
M 2018년 12월 3일
편집: M 2018년 12월 3일
In the command line, where you defined v, call the function this way:
>> v= [1 2 3 ;4 5 6];
>> mini(v)

이 질문은 마감되었습니다.

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by