Click here to Skip to main content
15,884,080 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

Here the code where I have a problem:

 F=ones(1,length(Agreable_Desagreable));
for i=1:length(x(1,:))
    group=F.*i
    end
end


With:
length(Agreable_Desagreable)=22
length(x(1,:))=85


The result only contains de last incrementation values:
group=[85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85]
22* the values 85

How can I do to store every value?

Thank you !

What I have tried:

for i=1:length(x ( 1 , : ))
for j=0:22:length(F)*length(x ( 1 , : ))
group(j)=F.*i

end
end

or

for i=1:length(x ( 1, : ))
group(i+(length(Agreable_Desagreable)-1))=F.*i
end

etc. Things like that and nothing works...
Posted
Updated 14-Jun-16 5:24am
v2
Comments
Matt T Heffron 14-Jun-16 12:46pm    
What is it that you are trying to accomplish?
What should group contain afterwards?
Use "Improve question" to describe what it is that you are trying to accomplish.
Kenneth Haugland 14-Jun-16 13:41pm    
if you use F.*i you don't need the for loop, it should just work straight up, as the .* is multiplying all the elements with the next value.
Matt T Heffron 14-Jun-16 17:12pm    
Yes, maybe...That's why I asked for clarification.
It appears that, maybe, group is expected to end up as two dimensions.
Or maybe group is just to end up as 22 concatenated F.*i vectors.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900