I want to create a target vector. In which I am having some problems. What I want is all the combinations of 3's of my 18 objects from T into Target. But It is unable to produce that combination. It is working for each combination individually but for me the "for loop" doesn't seem to work.
% T is a structure of 18 different sized objects
% idx is index of size 816*3 double
idx = combnk(1:18,3);
% TNames is cell of size 18*1
TNames = fieldnames(T);
for i = 1:length(idx)
Target(:,:,i) = [T.(TNames{idx(i,1)}) ;
T.(TNames{idx(i,2)}) ;
T.(TNames{idx(i,3)}) ];
end
The above code is working fine when I delete (:,:,i) from Target(:,:,i) and write 1,2,3 ... so on ... in places of T.(TNames{idx(i,1)})..T.(TNames{idx(i,2)}) and T.(TNames{idx(i,3)})
I had tried different alternatives but I'm unable to fix this problem.. I was even able to create a target <3*859 cell> but it is not acceptable to neural net. It needs to be <1*859 cell> for the neural net to work properly.. so, can someone help me to fix this issue?
I have also tried this:
T is a <1*1 struct> inside which i have 18 fints(Financial Timeseries) objects of 859 rows each and different no of columns(ranging from 1 to 4 columns in each fints object)..I have converted all those fints objects to matrices through fts2mat command.
Now I have new matrix <32*859 double> with identifiable fints objects in each column ranges. i.e. I can identify that first four entries in each column belong to first fints object and next 3 entries belong to 2nd fints object and so on.
I want to grab all the combinations (816 combinations) of 3 fints objects (out of 18) in a new matrix in such a way that can finally convert it into <859*1 cell> or <1*859 cell> (more precisely) to provide that to Neural network for proper training...
This task has to be done through indexing because each combination of 3's should contains 3 fints objects entries with each fints objects having different no. of columns. And I have to garb all the columns of each fints object everytime in my 816 combinations and concatenate those 3 fints objects. taking all the columns of each fints object and putting it in rows.
In short I should have <1*859 cell> in which there are 816 different combinations of 3 fints objects (out of my T struct) and each combination should have 3 fints objects in it and each combination should be of <1*859 cell> to provide it to neural network for proper training. Since NN doesn't take different dimension cells..
I thank you in advance