Clear Filters
Clear Filters

How to divide this array problem ?

3 views (last 30 days)
for example :
data = [6
7
5
3
4
1
2]
dataA = [6 7 3 1]
dataB = [6 5 4 2]
please I little bit confuse about this ,,,

Accepted Answer

monika shivhare
monika shivhare on 7 Jun 2018
data = [6 7 5 3 4 1 2];
dataA =[data(1) data(2:2:end)];
dataB =[data(1:2:end)];
  2 Comments
Muhammad Hafiz
Muhammad Hafiz on 7 Jun 2018
Edited: Muhammad Hafiz on 7 Jun 2018
thanks monica you help me ,,,
after dataA and dataB get the array ,,
how to remove, for example: dataA = [6 7 3 1] dataB = [6 5 4 2]
to
dataA = [7 3 1] dataB = [5 4 2]
monika shivhare
monika shivhare on 7 Jun 2018
Edited: monika shivhare on 7 Jun 2018
dataA=dataA(2:end);
dataB=dataB(2:end);
alternatively, use
dataA(1)=[];
dataB(1)=[];

Sign in to comment.

More Answers (0)

Categories

Find more on Earth, Ocean, and Atmospheric Sciences in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!