Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

where is the error ?

1 visualización (últimos 30 días)
KHAIF HICHEM
KHAIF HICHEM el 2 de Dic. de 2018
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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 comentarios
Walter Roberson
Walter Roberson el 2 de Dic. de 2018
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 el 3 de Dic. de 2018
can you show me ho to do ?

Respuestas (1)

M
M el 3 de Dic. de 2018
Editada: M el 3 de Dic. de 2018
In the command line, where you defined v, call the function this way:
>> v= [1 2 3 ;4 5 6];
>> mini(v)

La pregunta está cerrada.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by