Info

此问题已关闭。 请重新打开它进行编辑或回答。

Addition of time series extracted from a file

1 次查看(过去 30 天)
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".

回答(1 个)

per isakson
per isakson 2014-2-28
编辑:per isakson 2014-2-28
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!

Translated by