Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
|
![]() |
#1 |
高级会员
注册日期: 2019-11-21
帖子: 3,006
声望力: 66 ![]() |
![]()
在Matlab中扫描文本文件时,是否可以识别空白行?我想基于文本之间的空白行来解析文件。这可能吗?
回答: 是的,有可能。 MATLAB代码段如下所示: fid = fopen('reader.m'); newline = sprintf('\r\n'); line = fgets(fid); while ischar(line) if strcmp(newline, line) disp('Empty line'); else disp('Non-empty line'); end line = fgets(fid); end 更多&回答... |
![]() |
![]() |