unusual subscriptied assignment mismatch
Afficher commentaires plus anciens
I narrowed the occurence of the error down to some change in the variable b that happens in the 9th iteration of the loop. For some reason the zeros at the end are no longer kept and the assignment fails.
I figured out, that this change happens exactly when b becomes greater than 512, so I guess it has something to do with matlabs handling of doubles? Further, using the uncommented variable makes the code work just fine.
Please help me solve this problem.
var1 = 0.1;
vec = 1:1000;
% length_var = 100.0000;
length_var = 1/(var1 * 0.1);
for ii=1:20
a = round(ii*(0.25*length_var));
b = a - 1 + 3*length_var;
disp(b-a)
c(ii,:) = vec(a:b);
end
Réponse acceptée
Plus de réponses (1)
Matt J
le 11 Juin 2018
var1 = 0.1;
vec = 1:1000;
length_var = round( 1/(var1 * 0.1) );
c=nan(20,3*length_var);
for ii=1:20
a = round(ii*(0.25*length_var));
b = a - 1 + 3*length_var;
disp(b-a)
c(ii,:) = vec(a:b);
end
Catégories
En savoir plus sur Spline Postprocessing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!