Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Subscripted assignment dimension mismatch problem

2 visualizzazioni (ultimi 30 giorni)
Shifat
Shifat il 20 Mar 2012
Chiuso: MATLAB Answer Bot il 20 Ago 2021
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?

Risposte (0)

Questa domanda è chiusa.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by