Borrar filtros
Borrar filtros

Append matrix?

6 visualizaciones (últimos 30 días)
Trader
Trader el 31 de Mzo. de 2012
I'm currently building a cell matrix that is roughly 13x500 by adding a new row each time through a loop:
for i = period_start:1:period_end
... calculate values going into matrix ...
full_data(counter,:) = {counter current_date current_time position pa bp num_shares entry_price price sma t_band goshort l_band golong profit};
counter = counter + 1; end
I am using the counter because period_start does not always start at 1. Is there a way to append my values to the matrix without having to deal with the counter? I would like to build the array by passing the information to a function but I see my code getting very messy by passing counters. If I could send the values to the function and let it append it to the matrix I think I'd be in good shape. I would appreciate any recommendations you could provide.
Thank you

Respuestas (1)

Jan
Jan el 31 de Mzo. de 2012
The counter is the best idea, most of all because it allows to pre-allocate the result.

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by