How do I multiply an integer with a single value from the matrix?

%Start of the code
Module_Information = inputdlg ({'Thrust','Mixture Ratio','Reserve'},'Test', [1 50; 1 50; 1 50;]);
Exhaust_Veloctiy = 4 * Module_Information(1,1)
%End of the code
How do I extract "Moduel_Information(1,1)" or the "Thrust" and multiple with a integator, such as 4.

댓글 수: 2

madhan ravi
madhan ravi 2019년 6월 11일
편집: madhan ravi 2019년 6월 11일
Is it MATLAB? MATLAB doesn’t use // for comment.
Yes. It should have been a "%", instead of "//".

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

 채택된 답변

Stephen23
Stephen23 2019년 6월 11일
편집: Stephen23 2019년 6월 11일
You need to convert the character vector (contained in the output) into numeric, e.g.:
C = inputdlg(...); % C is a cell array of character vectors!
N = str2double(C{1}) % N is numeric!
N*4

댓글 수: 1

Thank you so much, the "str2double" was what I was looking. It worked.

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

추가 답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 6월 11일
편집: KALYAN ACHARJYA 2019년 6월 11일
Here Module_Information is cell
>> whos Module_Information
Name Size Bytes Class Attributes
Module_Information 3x1 192 cell
So
Exhaust_Veloctiy =4*Module_Information{1,1}

댓글 수: 1

Suleman Jalal
Suleman Jalal 2019년 6월 11일
편집: Suleman Jalal 2019년 6월 11일
I am not sure, however the answer does not correlates with the correct output. I attached a screenshot below of my code in the comman window. Screen Shot 2019-06-11 at 1.47.52 AM.png

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

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

질문:

2019년 6월 11일

댓글:

2019년 6월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by