How to divide the input data for two levels in matlab

L= 2; % L is no. of levels
L_total= 400;
[temp, alpha] = sort(rand(1,L_total)); %Howto divide this data into half for giving to two levels

 Accepted Answer

I don't know if I have understood your question, but this code split your variable in two:
a = temp(1:ceil(L_total/2));
b = temp(ceil(L_total/2)+1:end);
You can also use splitapply function

More Answers (0)

Categories

Find more on Language Fundamentals in Help Center and File Exchange

Tags

Asked:

on 21 Feb 2019

Edited:

on 22 Feb 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!