Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
number generation

Subject: number generation

From: amira ali

Date: 13 May, 2013 11:04:07

Message: 1 of 2

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

Subject: number generation

From: Steven_Lord

Date: 13 May, 2013 13:29:58

Message: 2 of 2



"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

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us