Info

此问题已关闭。 请重新打开它进行编辑或回答。

Subscripted assignment dimension mismatch problem

1 次查看(过去 30 天)
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 个)

此问题已关闭。

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by