How to remove stock prices that falls on weekend ?
3 ビュー (過去 30 日間)
古いコメントを表示
So I have got a big cell array having stock pricess of almost 1000 companies and then another datetime array having dates.I want to remove stock prices that falls on weekends.
I managed to get a logical column vector using is weekend function on the date time array but now I don't know how to use that logical column vector to remove rows of stock prices.
I tried using logical indexing but it didn't work.
7 件のコメント
Stephan
2019 年 3 月 2 日
im sure you have a csv, text or xls file as base. Dont you? extract 2-3 weeks from it and save a copy. if you do not know how to do this in Matlab perhaps you can do this in Excel or editor.
回答 (1 件)
Naman Bhaia
2019 年 3 月 1 日
Hey Sana,
After you have generated the logical vector you can use that logical vector as index positions to eliminate the values which fall on weekends. Consider the example
x=[1 2 3 4 5 6 7 8 9 10];
y=[1 1 0 1 1 0 1 1 0 1];
x(~y)=[]
4 件のコメント
Stephan
2019 年 3 月 1 日
Maybe creating a timetable is a good choice, since the usual functions of Financial Toolbox accept timetables as input argument. Deleting values from a table by logical statements is also very easy.
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!