Adding numbers to an array
Show older comments
Im trying to add values into an array using a for loop. This is my function but I hard coded it to work. Please help!
function[t1, t2, t3, t4, t5, t6, timeArr, maxArr, minArr, diagnosisArr] = findSinusArrhythmia(time, locationsR)
t1 = time(locationsR(7)) - time(locationsR(6));
t2 = time(locationsR(6)) - time(locationsR(5));
t3 = time(locationsR(5)) - time(locationsR(4));
t4 = time(locationsR(4)) - time(locationsR(3));
t5 = time(locationsR(3)) - time(locationsR(2));
t6 = time(locationsR(2)) - time(locationsR(1));
timeArr = [t1, t2, t3, t4, t5, t6];
maxArr = max(timeArr);
minArr = min(timeArr);
diagnosisArr = maxArr - minArr;
end
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!