Info
This question is closed. Reopen it to edit or answer.
Subscripted assignment dimension mismatch problem
1 view (last 30 days)
Show older comments
Hi. I am trying to expand a code. I idea is taken from this link:
function [digits,v]=csdigit(num,range,resolution)
Here 'digits' is a string ('0+0-00+0') and 'v' is a double. But when i want to use the above function for a matrix, it's showing error. Here is the code for matrix:
num_matrix = [1.5675 -4.5632 -1.2376; -6.4542 -5.7162 -2.4316;-5.7601 5.1009 -6.4820];
range = 5;
resolution = 15;
v = zeros(numel(num_matrix),1);
csd = repmat(' ', numel(num_matrix), range + resolution);
for i = 1: numel(num_matrix) %Can this loop be vectorized?
[csd(i,:),v(i)] = csdigit(num_matrix(i), range, resolution);
end
While running the above code, it's showing '??? Subscripted assignment dimension mismatch.' error. Can some please help me to solve the problem?
And is there any way to vectorize the above for loop so that it takes less time?
0 Comments
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!