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

采纳的回答

Vilém Frynta
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 个)

类别

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