Effacer les filtres
Effacer les filtres

How to change a single word in user interface with the input command?

2 vues (au cours des 30 derniers jours)
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

Réponse acceptée

Vilém Frynta
Vilém Frynta le 7 Fév 2023
Modifié(e) : Vilém Frynta le 7 Fév 2023
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 ÷)

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by