Escaped character '\U' is not valid. See 'doc sprintf' for supported special support.
28 views (last 30 days)
Show older comments
Krystal Xiwing Yau
on 20 Jan 2023
Commented: Walter Roberson
on 2 Feb 2023
Hi MATLAB users,
I know it's asked elsewhere on this webpage (https://ww2.mathworks.cn/matlabcentral/answers/435377-warning-escaped-character-u-is-not-valid). However, I have no idea how to fix it as I'm a newbie.
Below is the warning message that I got from the code. How can I edit it to a valid expression in MATLAB R2022b on Windows 11?
Many thanks in advance!
Warning: Escaped character '\U' is not valid. See 'doc sprintf' for supported special
characters.
> In ps_LST_lga (line 254)
In cfg_run_cm (line 29)
In cfg_util>local_runcj (line 1717)
In cfg_util (line 972)
In cfg_ui>MenuFileRun_Callback (line 710)
In gui_mainfcn (line 95)
In cfg_ui (line 53)
Current directory C:Warning: Escaped character '\U' is not valid. See 'doc sprintf' for supported special
characters.
> In ps_LST_lga (line 256)
In cfg_run_cm (line 29)
In cfg_util>local_runcj (line 1717)
In cfg_util (line 972)
In cfg_ui>MenuFileRun_Callback (line 710)
In gui_mainfcn (line 95)
In cfg_ui (line 53)
Warning: Directory already exists.
> In ps_LST_lga (line 290)
In cfg_run_cm (line 29)
In cfg_util>local_runcj (line 1717)
In cfg_util (line 972)
In cfg_ui>MenuFileRun_Callback (line 710)
In gui_mainfcn (line 95)
In cfg_ui (line 53)
Preprocessing of T1.nii 641s
Preprocessing of FLAIR.nii 145s
Coregister FLAIR to T1 91s
Initialize lesions 20-Jan-2023 15:21:31 - Failed 'LST: Lesion segmentation (LGA)'
Out of memory.
In file "C:\MRIapp\toolbox\spm12\toolbox\LST\ps_bwlabeln.m" (???), function "ps_bwlabeln" at line 24.
In file "C:\MRIapp\toolbox\spm12\toolbox\LST\ps_LST_lga.m" (???), function "ps_LST_lga" at line 427.
The following modules did not run:
Failed: LST: Lesion segmentation (LGA)
0 Comments
Accepted Answer
Jan
on 20 Jan 2023
Edited: Jan
on 20 Jan 2023
It is a typical bug under Windows, which does not occur, when the software is tested successfully in Linux:
fprintf(['Current folder: ', cd, '\n'])
The Windows file separators \ are interpreted as escape character for fprintf. Solution:
fprintf('Current folder: %s\n', cd)
Now the path appears as argument of fprintf and is not interpreted.
This concerns sprintf, warning and error message also:
error(['Bad folder: ' cd]) % Wrong output under Windows
error('Bad folder: %s', cd) % Working
Check line 254 of ps_LST_lga.m .
This is another problem: "Warning: Directory already exists." If you show us the corresponding part of the code, suggesting a solution is much easier.
"Out of memory." is not a warning, but a crash.
4 Comments
Walter Roberson
on 2 Feb 2023
Yes, it does, but I do not know why you are pointing that out to me ?
More Answers (0)
See Also
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!