how to solve 'ones error' in my code below
4 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!