필터 지우기
필터 지우기

Question matlab code

조회 수: 1 (최근 30일)
Will
Will 2012년 1월 6일
Hi,
I am a new user to matlab coding. I have written code to solve a simple FEA problem. The results depend on a number of variables defined initially. Currently these are defined manually but I would like to set it up so that a question can be asked, a value inputted and this value used for subsequent calculations. The code is working with some simple yes/no questions but it is when the answer is an integer that I am stuck. For example:
Question - What is the temperature on the left face? Answer - 60 (for example)
The answer 60 I want to use in code later on, how ca I do this?
Sorry if it's basic.
Thanks

채택된 답변

C.J. Harris
C.J. Harris 2012년 1월 6일
Try this:
faceTemp = input('What is the temperature on the left face?');
The variable 'faceTemp' will now hold the numeric value entered by the user.
  댓글 수: 3
C.J. Harris
C.J. Harris 2012년 1월 6일
Adding the 's' causes matlab to interpret the input as a string. This would therefore cause an error if you tried to perform any mathematical manipulation on the value.
Will
Will 2012년 1월 6일
Thanks very much!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by