Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Subscripted assignment dimension mismatch problem
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (0)
Questa domanda è chiusa.
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!