I imported two columns of data from a txt file but it came in as one column who can i split them up

2 vues (au cours des 30 derniers jours)
Is there a function i can use to split the dingle columns in two. I tried calculating the remainder of each entry number ( 1 2 3 4 etc) and moving into a separate matrix but it did not work. here is my code:
- A is a 1x12882 matrix where the odd number should be in the Thick column and the even numbers should be in the Thin columns
for i = length(A)
t= rem(i,2);
if t == 1
Thick(i)=A(i);
else
Thin(i) = A(i);
end
end
t=5

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 5 Mai 2015
a=[1;2;4;6;5;1;2;7;8;10]
idx=rem(a,2)==1
a1=a(idx)
a2=a(~idx)

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by