save dan load text file MATLAB
Posted by admin on March 15th, 2011
SAVE text file MATLAB
function SAVEmatlab;
x=0:0.1:1;
y = 0.5*x + 1;
y = y + 0.1*randn(1,11);
save(’testfile.txt’,'x’,'y’,'-ascii’);
stem(x,y); grid on;
end
.
LOAD text file MATLAB
function LOADmatlab;
close all;
clear all;
S = load(’testfile.txt’, ‘-ascii’);
x = S(1,:)
y = S(2,:)
% y = ax + b;
plot(x,y,’-rd’); grid on;
end