我正在尝试将来自多个数据文件的散点图放在一起,以查看它们之间的相关性。代码如下所示:
hold all
fia = fopen('data.txt');
A = fscanf(fia, '%f %f %f', [3 inf]);
t = A(1,:);
a = A(2,:);
r = A(3,:);
figure(1)
scatter(log(r),log(a),'r', '-');
fclose(fia);
fia = fopen('data.txt');
A = fscanf(fia, '%f %f %f', [3 inf]);
t = A(1,:);
a = A(2,:);
r = A(3,:);
figure(2);
scatter(log(r),log(a), 'g', '-');
fclose(fia);
依此类推,下一个数据点绘制在同一张图上:
fia = fopen('data.txt');
A = fscanf(fia, '%f %f %f', [3 inf]);
t = A(1,:);
a = A(2,:);
r = A(3,:);
figure(1);
scatter(log(r),log(a), 'rx');
fclose(fia);
等等。
但是当我在 Matlab 中运行该函数时,我得到了这个错误:
Error using specgraph.scattergroup/set
The name 'linestyle' is not an accessible property for an instance
of class 'scattergroup'.
Error in specgraph.scattergroup (line 26)
set(h,args{:});
Error in scatter (line 83)
h = specgraph.scattergroup('parent',parax,'cdata',c,...
Error in Ratioincrease (line 11)
scatter(log(r),log(a),'r', '-');
我怎样才能让 scattergroup 类似于线组,就像我如何正确编写它一样?