How to change a single word in user interface with the input command?
조회 수: 1 (최근 30일)
이전 댓글 표시
Dear matlab community,
I have following code, which does not run yet.
the variable fibres_without_BF contains of a 3x1 cell with some strings. I would like to change the word '%s' systematically in the for loop, but i don't know how the syntax should be. Can someone help me?
Thank you in advance,
Paul
fibres_without_BF = {'40p_546'}
fibres_without_BF{2,1} = {'41p_546'}
for i = 1:length(fibres_without_BF)
ok = input('does AN fibre %s look ok? (y/n) ', fibres_without_BF{i},'s');
end
댓글 수: 0
채택된 답변
Vilém Frynta
2023년 2월 7일
편집: Vilém Frynta
2023년 2월 7일
not sure if I understand your idea, but you could try doing this:
prompt = ['does AN fibre',fibres_without_BF{i},'look ok?']; % create flexible prompt
ok = input(prompt, 's'); % this is the correct syntax
simply, if you want your prompt (question) to change by for loop, you should create the prompt and then just call it inside input function.
edit: another version
prompt = sprintf('does AN fibre %s look ok?',fibres_without_BF{i});
hope it helps ÷)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!