'String scalar or character vector must have valid interpreter syntax' in waitbar

12 visualizaciones (últimos 30 días)
I am creating a waitbar where the text includes the path to the file being processed. The path name, ovbiously includes a backslash ('\') character, and this is causing the warning message to be issued: 'string scalar or character vector must have valid interpreter syntax'.
I could write a function to replace every ocurrence of the '\' character with '\\', but is there a way to set the interpreter to 'none' when calling the waitbar function?

Respuesta aceptada

Walter Roberson
Walter Roberson el 30 de Mzo. de 2023
Not directly, but just after you create your waitbar, like
wb = waitbar(0, 'File Name Will Go Here');
you can
wb.Children(1).Title.Interpreter = 'none';
Nothing in the code changes it back.
Or, you could instead use the Default properties, like
prop = 'DefaultTextInterpreter';
old_interp = get(groot, prop);
set(groot, prop, 'none');
wb = waitbar(0, 'File Name Will Go Here');
set(groot, prop, old_interp)
but I recommend the first version instead.

Más respuestas (1)

Fangjun Jiang
Fangjun Jiang el 30 de Mzo. de 2023
What is the issue? I don't have any error message in R2022b.
h=waitbar(0.5,'c:\abc\xyz')
  1 comentario
Jim Riggs
Jim Riggs el 30 de Mzo. de 2023
Mine defaults to the tex interpreter and gives me a warning messag.
Perhaps your setup is different.

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by