我正在尝试使用以下内容读取 .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 文件中的所有数据(主要是字符串)的更合适方法是什么?谢谢
嗨,我是一个新手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?