how to solve 'ones error' in my code below
조회 수: 2 (최근 30일)
이전 댓글 표시
Error using ones
Size inputs must be integers.
Error in matlab.internal.builtinhelper.repmat (line 59)
B = A(ones(siz,'int8'));
Error in inspect_rtmri (line 1097)
vid_rs = repmat(struct('cdata', [], 'colormap', []), 1, nf);
##### here is the code####
if nargin <= 2
M = varargin{1};
checkSizesType(M);
if isscalar(M)
siz = [M M];
elseif ~isempty(M) && isrow(M)
siz = M;
else
error(message('MATLAB:repmat:invalidReplications'));
end
siz = double(full(siz));
else % nargin > 2
siz = zeros(1,nargin-1);
for idx = 1:nargin-1
arg = varargin{idx};
if isscalar(arg)
siz(idx) = double(full(checkSizesType(arg)));
else
error(message('MATLAB:repmat:invalidReplications'));
end
end
end
if isscalar(A) && ~isobject(A)
B = A(ones(siz,'int8')); ###### the error comes from here
elseif ismatrix(A) && numel(siz) == 2
[m,n] = size(A);
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!