How to divide the input data for two levels in matlab

2 Ansichten (letzte 30 Tage)
nishika
nishika am 21 Feb. 2019
Bearbeitet: madhan ravi am 22 Feb. 2019
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

Akzeptierte Antwort

Alex Mcaulley
Alex Mcaulley am 21 Feb. 2019
Bearbeitet: madhan ravi am 22 Feb. 2019
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

Weitere Antworten (0)

Kategorien

Mehr zu Workspace Variables and MAT-Files finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by