主题:求助
通过fgetl(fid)读中文的话,每个字占4位
而直接用a='你们好!',则每个字只占2位,跟英文是一样的。
>> fid=fopen('1.txt')
fid =
3
>> a= fgetl(fid)
a =
你们好!
>>
>> whos
Name Size Bytes Class
a 1x8 16 char array
fid 1x1 8 double array
Grand total is 9 elements using 24 bytes
>> b='你们好!'
b =
你们好!
>> whos
Name Size Bytes Class
a 1x8 16 char array
b 1x4 8 char array
fid 1x1 8 double array
Grand total is 13 elements using 32 bytes
如果我想替代第一种用fgetl读取的字符串中某个字怎么操作
因为
>> a(1)
ans =
?
或者有没有办法把用fgetl读取的信息变成跟直接赋值一样的,占位变少。
而直接用a='你们好!',则每个字只占2位,跟英文是一样的。
>> fid=fopen('1.txt')
fid =
3
>> a= fgetl(fid)
a =
你们好!
>>
>> whos
Name Size Bytes Class
a 1x8 16 char array
fid 1x1 8 double array
Grand total is 9 elements using 24 bytes
>> b='你们好!'
b =
你们好!
>> whos
Name Size Bytes Class
a 1x8 16 char array
b 1x4 8 char array
fid 1x1 8 double array
Grand total is 13 elements using 32 bytes
如果我想替代第一种用fgetl读取的字符串中某个字怎么操作
因为
>> a(1)
ans =
?
或者有没有办法把用fgetl读取的信息变成跟直接赋值一样的,占位变少。