⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 writeoutputfile.m

📁 实现matlab很多功能的源代码
💻 M
字号:
mFiles=dir('string*.m');
mFiles={mFiles.name};

for i=1:length(mFiles)
	% ====== Execute each command
	command=mFiles{i}(1:end-2);
	fprintf('%d/%d: %s\n', i, length(mFiles), command);
	outputFile=['output/', command, '.txt'];
	outImgFile=['output/', command, '.jpg'];
	delete(outputFile);
	diary(outputFile);
	eval(command);
	diary off;
	% ====== Get rid of empty line
	clear content
	content=fileRead(outputFile);
	index=[];
	for j=1:length(content)
		if isempty(content{j})
			index=[index, j];
		end
	end
	content(index)=[];
	% ====== Write output file
	fileWrite(content, outputFile);
	% ====== Write image file
	mContent=fileRead(mFiles{i});
	usePlot=0;
	for j=1:length(mContent),
		if ~isempty(findstr(mContent{j}, 'plot')), usePlot=1; break; end
	end
	if usePlot,
		print('-djpeg', outImgFile);
	end
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -