小编lea*_*lab的帖子

如何使用文本扫描读取文件中的所有行

我正在尝试使用以下内容读取 .m 文件中的所有行

file_content = textscan(fid, '%s', 'delimiter', '\n', 'whitespace', '')
Run Code Online (Sandbox Code Playgroud)

但这只是返回

file_content = 

    {0x1 cell}
Run Code Online (Sandbox Code Playgroud)

实际上我的文件有 224 行。所以如果我使用

file_content = textscan(fid,'%s',224,'delimiter','\n')
Run Code Online (Sandbox Code Playgroud)

我明白了所有的台词

file_content = 

    {224x1 cell}
Run Code Online (Sandbox Code Playgroud)

读取 .m 文件中的所有数据(主要是字符串)的更合适方法是什么?谢谢

matlab

5
推荐指数
1
解决办法
4万
查看次数

简单的perl添加程序出错?

嗨,我是一个新手perl学习者这个简单的perl程序

$inputline= <STDIN>;
print "first input";
print( $inputline); 
$inputline=<STDIN>;
print "second input";
print($inputline);
$sum= $inputline+$inputline;
print"sum 1stinput and 2ndinput";
print($sum);
Run Code Online (Sandbox Code Playgroud)

产量

perl count.pl
3
4
first input3
second input4
sum 1stinput and 2ndinput : 8
Run Code Online (Sandbox Code Playgroud)

为什么输出8而不是7?

perl

2
推荐指数
2
解决办法
2384
查看次数

标签 统计

matlab ×1

perl ×1