How to save the values of (x,C) in file 1 and (x,y) in file 2 to plot them in file 3.. the description in the code below
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
% file 1
clc;
clear;
x=[1 3 2 5 8]
for i=1:10
C=i*(x);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% file 2
clc;
clear;
y=[2 3 1 6 8]
or i=1:10
C=i*(x);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%
% file 3
plot(x,C)
hold on
plot(y,C)
Réponse acceptée
KSSV
le 11 Juin 2021
% file 1
clc;
clear;
x=[1 3 2 5 8] ;
C = zeros(10,length(x)) ;
for i=1:10
C(i,:)=i*x;
end
writematrix(C,'file1.txt') ;
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% file 2
y=[2 3 1 6 8] ;
C = zeros(length(y),10) ;
for i=1:10
C(i,:)=i*y;
end
writematrix(C,'file2.txt') ;
%%%%%%%%%%%%%%%%%%%%%%%%%%
% file 3
C1 = importdata('file1.txt') ;
x = data(:,1) ;
C2 = importdata('file2.txt') ;
y = data(:,1) ;
plot(x,C1)
hold on
plot(y,C2)
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Annotations 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!