How to save and crossing process of multiple sequence file?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Amra Rajuli
le 19 Avr 2018
Réponse apportée : Etsuo Maeda
le 23 Avr 2018
suppose I have two files (attached). I plan to do cross math operation, for instance: the first column of A file multiply with the third column of B file.How to do that? Here the script I used (in this script, I can only process different column of the same file).
for i = 1:2 id = i; str_id = num2str(id,'%4.1i'); ts = load(['old_',str_id,'.txt']); x=ts(:,1) y=ts(:,2) z=ts(:,3)+ts(:,2) b = [x y z] end
save('new_',num2str(i),'.txt','b','-ascii')
Then, when I try to save it as new sequence file, it only saves the last file (new_2). Thank you for your help
0 commentaires
Réponse acceptée
Etsuo Maeda
le 23 Avr 2018
I am not sure what you want to do.
Anyway, your code just make an error in the save command.
save('new_',num2str(i),'.txt','b','-ascii')
should be
save(['new_',num2str(i),'.txt'],'b','-ascii')
And also, if you want to get new_1.txt and new_2.txt, the save command should be included in the for loop
for i = 1:2
id = i;
str_id = num2str(id,'%4.1i');
ts = load(['old_',str_id,'.txt']);
x=ts(:,1)
y=ts(:,2)
z=ts(:,3)+ts(:,2)
b = [x y z]
save(['new_',num2str(i),'.txt'],'b','-ascii')
end
MATLAB tutorials will help you to understand this problem.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with MATLAB 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!