Filter löschen
Filter löschen

Append matrix?

6 Ansichten (letzte 30 Tage)
Trader
Trader am 31 Mär. 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

Antworten (1)

Jan
Jan am 31 Mär. 2012
The counter is the best idea, most of all because it allows to pre-allocate the result.

Kategorien

Mehr zu Creating and Concatenating Matrices 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!

Translated by