Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Subscripted assignment dimension mismatch problem

2 Ansichten (letzte 30 Tage)
Shifat
Shifat am 20 Mär. 2012
Geschlossen: MATLAB Answer Bot am 20 Aug. 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?

Antworten (0)

Diese Frage ist geschlossen.

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by