From: PO_STA St-Arnaud on
Hi!
I have a set of data i want to plot now, and another sets of data that i want to add later, but with the corresponding legend. I thought of using simply a "open, saveas" structure but it does not work properly. Any ideas?
From: us on
"PO_STA St-Arnaud" <pierre-olivier.st-arnaud.1(a)ulaval.ca> wrote in message <i24vrd$c3j$1(a)fred.mathworks.com>...
> Hi!
> I have a set of data i want to plot now, and another sets of data that i want to add later, but with the corresponding legend. I thought of using simply a "open, saveas" structure but it does not work properly. Any ideas?

most likely... if you show your code...

us
From: PO_STA St-Arnaud on
Heres the whole code, this is what it looks like so far ;
_____________________________________________________________________
function graph_data(filename)

% inputs: filename: name of the file to read (ex:'test.dat')

%% Obtain number of lines/Save data in a matrix

ntitle=8; %number of lines (title)
fid=fopen(['C:\Documents and Settings\Data\',filename],'r'); %open file (read)


if (fid==-1)
disp('No file'); %verification (opening file)
else
read = 1;
for i=1:ntitle
tline=fgetl(fid);
end
nline=0;
tline=0;
while tline~=-1
tline = fgetl(fid);
if tline~=-1
nline=nline+1;
end
end
fclose(fid);
end

format long e
fid=fopen(['C:\Documents and Settings\Data\',filename],'r');

ncol = 6; %number of column

if fid==-1
disp('No file');
else
for k=1:ntitle;
tline=fgetl(fid);
end

for i=1:nline;
for j=1:ncol;
data(i,j)=fscanf(fid,'%g',1);
end
end
fclose(fid);
end

%% Graph for data

time = data(:,1);
displacement_press = data(:,2);
displacement_axial = data(:,5);
displacement_radial = data(:,6);

fopen(['C:\Documents and Settings\Data\','graph_triaxialcell.fig'])
hold on

subplot(2,1,1) % Axial displacement, function of time
AXIAL = line(time, displacement_axial);
set(AXIAL , ...
'LineStyle' , '--' , ...
'Color' , [0 .5 0] );

subplot(2,1,2) % Radial displacement, function of time
RADIAL = line(time, displacement_radial);
set(RADIAL , ...
'LineStyle' , '--' , ...
'Color' , [0 .5 0] );

set(gcf, 'PaperPositionMode', 'auto');
saveas(gcf,['C:\Documents and Settings\Data\','graph_triaxialcell.fig'])
_____________________________________________________________________