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

조회 수: 2 (최근 30일)
Kevin Carty
Kevin Carty 2020년 2월 15일
댓글: Kevin Carty 2020년 2월 15일
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
Walter Roberson
Walter Roberson 2020년 2월 15일
How are you inputing more than one number?
Kevin Carty
Kevin Carty 2020년 2월 15일
I figured it out.
I was doing mileConverter(1,2,3) when I should've done mileConverter([1,2,3])

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by