Index in position 1 is invalid. Array indices must be positive integers or logical values.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I have tried various combinations of integers and no matter what I seem to do my code won't work.
inkvar=length(changeink)*var(rat_ink(changeink));
I have tried several different combinations including but not limited too:
inkvar=length(changeink)*var(rat_ink(changeink,1),1));
ink_variance=length(changeink)*var(rat_ink(changeink(1,1)*1,2));
I have even tried changing the names of my variables, nothing is working! I don't know what else to do!
changeink is 10x1 and rat_ink is 10x2
3 Kommentare
Walter Roberson
am 30 Sep. 2020
What is min(changeink) and max(changeink) ?
What shows up for
unique(mod(changeink,1))
Antworten (1)
Cris LaPierre
am 30 Sep. 2020
Bearbeitet: Cris LaPierre
am 30 Sep. 2020
Your values are not integers. For example, what value should rat_ink(79.7,1) return? Valid indices are 1, 2, 3, etc.
4 Kommentare
Cris LaPierre
am 30 Sep. 2020
You use indices inside indices. I suspect the same thing is going on with rat_ink.
Try the following:
rat_ink(round(changeink),1),1)
var(rat_ink(round(changeink),1),1))
var(round(rat_ink(round(changeink),1)),1))
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!