How to remove stock prices that falls on weekend ?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Stephan
am 2 Mär. 2019
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.
Antworten (1)
Naman Bhaia
am 1 Mär. 2019
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 Kommentare
Stephan
am 1 Mär. 2019
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.
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!