Borrar filtros
Borrar filtros

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

2 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Vilém Frynta
Vilém Frynta el 7 de Feb. de 2023
Editada: Vilém Frynta el 7 de Feb. de 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 ÷)

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by