|
I try to read a text files with 20x20 data into variable C, and attempt to plot a histogram on the left Y-axes, and a ecdf/ksdensity on the right X-axes.
Using textscan, the data is read into a 400x1 array. However, when I tried to call plotyy to plot histogram, the code belows return
-------------------------------------------
Error using plot
Vectors must be the same lengths.
Error in pt (line 11)
axes = plotyy(x,C{1},x,C{1});
-------------------------------------------
I guess it is due to C{1}. But have no clue on how to resolve it. I am new to matlab, would anyone point out the correct way to perform the above operations?
-------------------------------------------
fid = fopen('t1_error.txt','r');
C = textscan(fid, '%.3f');
fclose(fid);
disp(C{1});
x = -1:7;
axes = plotyy(x,C{1},x,C{1});
hold on
hist(axes(1), C{1}, x);
ylim(axes(1),'auto');
set(axes(1),'mode','auto');
hold off
-------------------------------------------
|