필터 지우기
필터 지우기

How to use input command?

조회 수: 4 (최근 30일)
Shawn Simon
Shawn Simon 2015년 10월 23일
댓글: Shawn Simon 2015년 10월 23일
The purpose of these two lines is for the user to input the name the "planet", then the next question asks the mass of the planet. In the second line, I am trying to call the variable 'name' so the question in line 2 incorporates the name of the planet. However, I get an error on the second line saying "Too many input arguments". Also, I am new to MATLAB. Please help
name = input('What is the name of the exoplanet? ', 's');
massplanet = input('What is the estimated mass of %s (kg)? ', 's', name);

채택된 답변

Adam
Adam 2015년 10월 23일
편집: Adam 2015년 10월 23일
massplanet = input( sprintf('What is the estimated mass of %s (kg)? ', name), 's');
  댓글 수: 1
Shawn Simon
Shawn Simon 2015년 10월 23일
Thank you so much for your help and fast response!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Earth and Planetary Science에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by