Plotting a fit with excluded data results in error "Subscript indices must either be real positive integers or logicals."
Mostra commenti meno recenti
I have fitted some data where I have excluded the first point and now would like to plot it. I'm using the command
exclude = 1;
handle = plot(fit,'b',time,data,'+k',exclude,'xr');
From that I get the error
Subscript indices must either be real positive integers or logicals.
Error in cfit/plot (line 229)
xpoints(outliers),ypoints(outliers),S3,...
Error in calcFRETDecayDelta_broken (line 558)
handle = plot(fit,'b',time,data,'+k',exclude,'xr');
Setting
exclude = 2;
or
exclude = [1 2];
or typecasting the 1 to a boolean works just fine. I'm reading the exclude vector from a textfile and would like to keep it in the index format there.
So I have now made a workaround by making the index exclude a boolean, which is also accepted by plot:
ex = zeros(max(exclude),1);
ex(exclude) = 1;
exclude = boolean(ex);
The question however is, why does plot not accept a simple 1 for exclusion? This is unnecessary cumbersome.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Creating, Deleting, and Querying Graphics Objects in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!