invsystem.m
来自「toolbox of BVQX, This is the access betw」· M 代码 · 共 48 行
M
48 行
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 + =
减小字号Ctrl + -
显示快捷键?