Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: truncation problem
Replies: 5   Last Post: Jan 12, 2014 1:48 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Nasser Abbasi

Posts: 5,645
Registered: 2/7/05
Re: truncation problem
Posted: Jan 10, 2014 2:40 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 1/9/2014 11:55 PM, Mohammad Sayeed wrote:
> Dear Nasser
> Thank you for your kind reply. but my problem is more general one.
>say that I have hourly price information in a matrix. in the first column
>I have the hours from 1 to 24 repeatedly for 10 days. in the second column
>I have the prices of each hour for a given stock. I need to get rid of
>first 10 hours and last 4 hours from the matrix and have the 11th to 20th
>hours' data for each ten days. Can I do it by using MATLAB? Your contribution will help me a lot.
>
> Kind regards
>
> Sayeed
>


There are many ways to do this, here is one way, I am sure there
are better ways but I am lazy now

--------------------------
nDays = 5;
nhrs = 24;
data = rand(nDays*nhrs,2);
size(data)

120 2

r = arrayfun(@(i) data(nhrs*(i-1)+11:nhrs*(i-1)+20,:),1:nDays,'UniformOutput',false);
filteredData = cell2mat(r');
size(filteredData)

50 2
-------------------------

--Nasser



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.