On 6/14/2012 9:40 AM, DRG wrote:
> Greetings all. I have a code which ... Goes like this
>
> N = input('Specify number of fractions: '); f = 80 / N; %divides the
> total number into fractions d = 1:1:f ; %makes chunks of that
> fraction for m = 1:N; s(d,m) = (exp((5.*d) (7.*(d.^2)))).^m ;
% Don't do thism is the loop variable and will increment automagically
% Matlab is smart enough it won't allow it anyway, but don't fool w/
% the natural scheme of things...
> % m = m +1; end
>
> This gives me an array and this is fine.
Oh, really???? I get
>> N=8; f = 80 / N; %divides the total number into fractions
d = 1:1:f ; %makes chunks of that fraction
for m = 1:N;
s(d,m) = (exp((5.*d) (7.*(d.^2)))).^m ;
end
??? In an assignment A(matrix,matrix) = B, the number of rows in B
and the number of elements in the A row index matrix must be the same.
>>
If I assume you meant to write 'd' for 'm', then it'll run but there's
only a single value that isn't <<<1 and 90% or so 
>> s(10)
ans =
9.8542e034
>> s(2)
ans =
1.6285e266
>> sum(sum(s~=0))
ans =
11
>>
Seems unlikely to be of much use???
> ... When I choose my fraction to be 10, for example, I get chunks of
> 8. But what I'm interesting in doing in making a new array from
> this, sequentially combining the results of the two dimensional array
> into a linear one; for the example of 8, I can do this long form by;
>
> Total = [s(:,1)' s(:,2)' s(:,3)' ... s(:,8)' s(:,9)' s(:,10)'];
>
> It works, but is there a way to generalise this method...
Questions of the purpose/usefulness aside, that's just
T=reshape(s',mumel(s),1);

