📄 invsystem.m
字号:
function [output, status] = invsystem(command, newlineend)
% invsystem - inverts the output argument order of system(...)
%
% FORMAT: [output,status] = invsystem(command [,newlineend])
%
% Input fields:
% command command that is passed to system(...) call
% newlineend if given and == 1 leave trailing newlines in place
%
% See also system, unix, dos.
% Version: v0.5c
% Build: 6120415
% Date: Dec-04 2006, 3:15 PM CET
% Author: Jochen Weber, Brain Innovation, B.V., Maastricht, NL
% URL/Info: http://wiki.brainvoyager.com/BVQXtools
% enough arguments ?
if nargin < 1
error( ...
'BVQXtools:TooFewArguments',...
'Too few arguments. Try ''help %s''.',...
mfilename ...
);
end
% do command with reversed arguments
try
[status,output] = system(command);
% possibly remove any trailing newlines from output
if nargin < 2 || ...
~isnumeric(newlineend) || ...
isempty(newlineend) || ...
isnan(newlineend(1)) || ...
newlineend(1) ~= 1
while length(output) > 0 && ...
(output(end) == char(10) || output(end) == char(13))
output(end) = [];
end
end
% on error give status 1 and error message
catch
status = 1;
output = lasterr;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -