필터 지우기
필터 지우기

Variable isn't showing in the input command (A little square appears instead)

조회 수: 11 (최근 30일)
El Vapor
El Vapor 2020년 4월 24일
댓글: El Vapor 2020년 4월 24일
Hey, I'm new in Matlab but have been searching and didn't find anything that solves my question.
I wrote this:
for i=1:NEOx
VNEOx(i) = input(['Introduzca la Masa Molar del elemento ' i ': ']);
end
But what I am getting in return isn't the variable "i", which should be firstly 1, then 2...etc. Instead I am getting some little squares:
Any idea about what I am doing wrong?
Thank you very much

답변 (1개)

Tommy
Tommy 2020년 4월 24일
Try either
for i=1:NEOx
VNEOx(i) = input(['Introduzca la Masa Molar del elemento ' num2str(i) ': ']);
end
or
for i=1:NEOx
VNEOx(i) = input(sprintf('Introduzca la Masa Molar del elemento %d: ', i));
end

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by