这个M文件我是在figure中generate的,可是在把它存了,所存文件名是aa.m,调用就不对了。。。高手麻烦看一下。
function createfigure(x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6)
%CREATEFIGURE(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6)
% X1: vector of x data
% Y1: vector of y data
% X2: vector of x data
% Y2: vector of y data
% X3: vector of x data
% Y3: vector of y data
% X4: vector of x data
% Y4: vector of y data
% X5: vector of x data
% Y5: vector of y data
% X6: vector of x data
% Y6: vector of y data
% Auto-generated by MATLAB on 18-May-2009 11:51:47
%% Create figure
figure1 = figure(...
'FileName','C:\MATLAB7\work\untitled29.fig',...
'PaperPosition',[0.6345 6.345 20.3 15.23],...
'PaperSize',[20.98 29.68]);
%% Create axes
axes1 = axes('Parent',figure1);
axis(axes1,[0 120 0 10]);
hold(axes1,'all');
%% Create plot
plot1 = plot(...
x1,y1,...
'LineStyle','none',...
'Marker','o',...
'Parent',axes1,...
'DisplayName','data 1');
%% Create plot
plot2 = plot(...
x2,y2,...
'LineStyle','none',...
'Marker','o',...
'Parent',axes1,...
'DisplayName','data 2');
%% Create plot
plot3 = plot(...
x3,y3,...
'LineStyle','none',...
'Marker','o',...
'Parent',axes1,...
'DisplayName','data 3');
%% Create plot
plot4 = plot(...
x4,y4,...
'LineStyle','none',...
'Marker','o',...
'Parent',axes1,...
'DisplayName','data 4');
%% Create plot
plot5 = plot(...
x5,y5,...
'LineStyle','none',...
'Marker','o',...
'Parent',axes1,...
'DisplayName','data 5');
%% Create plot
plot6 = plot(...
x6,y6,...
'Color',[0 0.5 0],...
'Parent',axes1,...
'DisplayName',' shape-preserving');
%% Create legend
legend1 = legend(axes1,{'data 1','data 2',' shape-preserving','data 3','data 4','data 5'});
最后输入aa图没有画出来,只画出了坐标,命令窗返回的是:
>> aa
??? Input argument "x1" is undefined.
Error in ==> aa at 30
plot1 = plot(...
>>
好像还是不对,我把那些省略号补上也不行。。。 哪位高手再说一下哈,为什么由matlab在figure中generate的m文件都用不了啊?是不是我的操作问题呢?
我的意思是说用x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6替代省略号,保存文件名用createfigure.m其他的没改还是不行,输入后是
>> createfigure.m
??? The function, script, or class createfigure
cannot be indexed using {} or . indexing.