Time series syntax question
1 view (last 30 days)
Show older comments
Hi everyone, I'm using a template for a homework assignment in MATLAB. I'm having trouble with a section that seems to require time series, but I can't find any info on this particular type. The code is: ts(i,1) =%fill in here . I've never seen the ts(i,1) syntax before, and can't find any info on it anywhere. Can anyone explain to me what this means?
2 Comments
Accepted Answer
Image Analyst
on 26 Nov 2014
ts(i, 1) refers to the element of the ts array in the i'th row and the first column. Assuming i is a single number , like 5 or whatever, then ts(i,1) would be assigned a single number, like 73 or whatever.
ts(i, 1) = 73;
If i = 5, this would assign ts(5,1) a value of 73.
If i is an array of numbers or array of logicals then ts(i,1) would assign a bunch of rows in the first column. Like if i were [2,4,8], ts(i,1) would need to take 3 numbers, like
ts(i, 1) = [22,34,88];
This would assign element ts(2,1) to 22, element ts(4,1) to 34, and assign element ts(8,1) to 88. I hope that explains it better.
0 Comments
More Answers (1)
Youssef Khmou
on 26 Nov 2014
ts(i,1) means performing calculation of the elements of first column of matrix ts, ts(i,2) means the ith element on the second column, ( use other variable instead of i, i is the imaginary number )
2 Comments
See Also
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!