Info

This question is closed. Reopen it to edit or answer.

Addition of time series extracted from a file

1 view (last 30 days)
Venkatesh M Deshpande
Venkatesh M Deshpande on 27 Feb 2014
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi, Here is the code
p=zeros(q,r);
p(q,i)=sum(x.Time_Series(:,s(i,1))));
Please note the following points. 1. x.Time_Series gives me the time series of 688 taps(points). Each tap has 49792 readings which can be positive or negative numbers. Therefore, x.Time_Series is 49792*688 matrix. 2. I require readings of only 9 taps and these are extracted in s. s is 1*9 matrix and represents the column no of each tap 66 68 69 79 . . 80 3. value of r is 9.
My Problem: I want to make a single matrix p which stores the sum of corresponding elements of matrices of 9 taps(points) given in s. When I run the above code, it says "Subscript indices must either be real positive integers or logicals".

Answers (1)

per isakson
per isakson on 28 Feb 2014
Edited: per isakson on 28 Feb 2014
Study this example:
M = randn( 1000, 10 );
ix = [ 3, 5, 7 ];
S = sum( M(:,ix), 1 );
it returns
>> S
S =
38.2749 30.5600 3.8223
which are the sums of column number 3, 5 and 7

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!