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)
Afficher commentaires plus anciens
Ben Johannesson
le 5 Mai 2015
Réponse apportée : Azzi Abdelmalek
le 5 Mai 2015
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
0 commentaires
Réponse acceptée
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)
0 commentaires
Plus de réponses (0)
Voir également
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!