"Sam " <email@example.com> wrote in message <firstname.lastname@example.org>...
> There is a vector Data, which is:
> I need to define two different outputs for this Data
> n = length(N);
> DataIndex = zeros((n^3+5*n+6)/6,n);
> p = n:-1:1;
> s = 0;
> for k = n:-1:n-3
> c = nchoosek(p,k);
> for m = 1:size(c,1)
> s = s + 1;
> DataIndex(s,c(m,:)) = N(c(m,:));
> % Index indicating which values we need in both Data and DIndex (where the values are zero) for example
> Out2_16=Data (22)-Data(1)*Data(2)*Data(3);
> Out2_35=Data (41)-Data(4)*Data(5)*Data(6);
> I need to write a loop that took the data and excute this function.
- - - - - - - - -
A partial answer is that somewhere you will need the expression:
This will give you the right sides of your indicated outputs for a general index 'ix' into 'Data'. I have no idea how you want your two outputs indexed however, so you will have to figure out how to use this to generate them in for-loops.