I want to display name of variable in msgbox instead of its value. for example;

조회 수: 1 (최근 30일)
msahar
msahar 2014년 11월 3일
답변: Stalin Samuel 2014년 11월 3일
I want to display name of variable in msgbox instead of its value. for example;
d1=3 ; d2=5 ; d3=2 y = [d1 d2 d3]; x=min(y); % 2
% The minimum value coressponds to d3
msgbox('????????')
msgbox should display " The minimum value is of d3 "

답변 (2개)

MA
MA 2014년 11월 3일
d1=3;d2=5;d3=2;
y=[d1 d2 d3];
x=min(y)
good luck
  댓글 수: 2
msahar
msahar 2014년 11월 3일
x contain the minium value, this minimum value corresponds to d3, how to display d3 instead of value of x which is 2. This is called reflection in other languages.
MA
MA 2014년 11월 3일
try this:
clear all
clc;
d1=3;d2=5;d3=2;
y=[d1 d2 d3];
x=min(y);
message = sprintf('min = %4d\n', x);
uiwait(msgbox(message));
fprintf(message);
good luck

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


Stalin Samuel
Stalin Samuel 2014년 11월 3일
msgbox('The minimum value is of d3 ')

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by