Append matrix?

8 ビュー (過去 30 日間)
Trader
Trader 2012 年 3 月 31 日
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

回答 (1 件)

Jan
Jan 2012 年 3 月 31 日
The counter is the best idea, most of all because it allows to pre-allocate the result.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by