Effacer les filtres
Effacer les filtres

Unit Converter: Miles to Feet. Having trouble outputting an array.

2 vues (au cours des 30 derniers jours)
Kevin Carty
Kevin Carty le 15 Fév 2020
Commenté : Kevin Carty le 15 Fév 2020
I am trying to write a script that converts miles to feet. The output can be a single number or an array of numbers.
When I run the function it works well with one numer but when i input multiple numbers it says there are too many input arguments.
Here is my code:
function [feetConversion] = mileConverter(miles)
unitConvCalc = miles * 5280;
feetConversion = [unitConvCalc]
end
  2 commentaires
Walter Roberson
Walter Roberson le 15 Fév 2020
How are you inputing more than one number?
Kevin Carty
Kevin Carty le 15 Fév 2020
I figured it out.
I was doing mileConverter(1,2,3) when I should've done mileConverter([1,2,3])

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by