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 にキャストされた double を無視するのはなぜですか? cast(340, 'char') も試しましたが、同じ無知の問題です。strcat('hello','324','.txt')後者では機能しましたが、機能しませんでした。なぜこの振る舞いをするのですか?
strcat('hello','324','.txt')
num2strchar にキャストしようとする代わりに、使用する必要があると思います。私は今これをテストするためのMatlabを持っていませんが、私はそれを想像しますchar(65) == 'A'(つまり、ascii)どこがnum2str(65)間違いなく等しい'65'ので、char(2340)が返す文字を誰が知っていますか...
num2str
char(65) == 'A'
num2str(65)
'65'