Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
目标
>> strcat('D_', char(2340), '.txt') D_2340.txt
>> strcat('D_', char(2340), '.txt')
D_2340.txt
但 D_.txt 失败。为什么它忽略双重转换为char?我也试过 cast(340, 'char') 但同样的无知问题。它适用于后者,strcat('hello','324','.txt')但不适用于后者。为什么会有这种行为?
strcat('hello','324','.txt')
我认为您应该使用num2str而不是尝试强制转换为 char。我现在没有Matlab来测试这个,但我想char(65) == 'A'(即ascii)num2str(65)绝对等于'65'所以谁知道char(2340)会返回什么字符......
num2str
char(65) == 'A'
num2str(65)
'65'