How to remove stock prices that falls on weekend ?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Stephan
el 2 de Mzo. de 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.
Respuestas (1)
Naman Bhaia
el 1 de Mzo. de 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 comentarios
Stephan
el 1 de Mzo. de 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.
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!