I am trying to construct an array by attaching single columns on that array within a for loop. I am doing that by first initializing a column of zeros and placing each new column I read at the right hand side of the updated vector. But unfortunately, this works partially, and only after making a restriction, i.e. keeping only the first - for example - 500 rows of each new vector.
Regarding the following solution on the problem, first of all I don't understand why this zero column vector do no appear in the last array! The other problem is that even if I do know the total number of columns of the final array from the beginning, in some cases I do not know the actual number of rows of the separate columns. Actually, I want to consider, as the default number of rows in my final array, the bigger number of rows among the different single columns to be attached, so I assume that, the best practice should be to run into the whole number of columns deciding about the bigger number of rows, then setup up the appropriate dimension of the initial array to be filled by the single columns data, and finally to fill the first based on the latter ones.
Any suggestion will be highly appreciated!
data = zeros(500,1);
for symbol = 1:length(symbol_list),
[hist_data] = retrieve_data(symbol_list(symbol));
data = [data hist_data(1:500)];
end
EDIT:
Let me give you an input/output example:
I want to place the following three columns (I retrieve one of them in each iteration)
0.402513860949959 0.401546899405730 0.405949059210334
0.401396441661866 0.400288848738267 0.403936753893693
0.400862023741474 0.402233108860710 0.404473368644797
0.411161714570851 0.413612748989126 0.409437055092511
0 0.414870799656589 0.415071509979105
0 0.416586323294039 0
one next to the other, ending up with the following table (keep only the ones with the bigger yet the same number of rows - thus, here I keep only the second column):
0.401546899405730
0.400288848738267
0.402233108860710
0.413612748989126
0.414870799656589
0.416586323294039
In other words, I have a very big number of columns that I want to attach one next to the other. The majority of them have a very big length of rows which is the same. However, some other have arbitrary smaller number (length) of rows. What I what is to find this "big" number of rows, keep only the columns correspond to this "big" length, and finally place one next to the other.