Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: number generation
Replies: 1   Last Post: May 13, 2013 9:29 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 17,944
Registered: 12/7/04
Re: number generation
Posted: May 13, 2013 9:29 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply



"amira ali" <amiraali2005@gmail.com> wrote in message
news:kmqhb7$hto$1@newscl01ah.mathworks.com...
> hello
>
> i have numbers from 1:100 and i have 25 runs then i want:
>
> first_run :number (1:4) used for test and the rest of 100 numbers(=96
> number) used for train
>
> seconed_run :number (5:8) used for test and the rest of 100 numbers(=96
> number) used for train
>
> third_run :number (9:12) used for test and the rest of 100 numbers(=96
> number) used for train
>
> 25_run :number (97:100) used for test and the rest of 100 numbers(=96
> number) used for train


n = 20; % for demonstration; in the real case, this would be 100
mydata = 1:n;
for firstTestIndex = 1:4:n
testValues = mydata(firstTestIndex:firstTestIndex+3)
trainValues = mydata([1:firstTestIndex-1 firstTestIndex+4:n]) % or
% trainValues = mydata;
% trainValues(firstTestIndex:firstTestIndex+3) = []
% Operate on testValues and trainValues
end

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com



Date Subject Author
5/13/13
Read number generation
amira ali
5/13/13
Read Re: number generation
Steven Lord

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.