Mesh and Line Graph from CSV File

1 view (last 30 days)
Maeve O'Brien
Maeve O'Brien on 11 Feb 2020
Answered: Charan Jadigam on 3 Mar 2020
Hello!
I'm trying to create both a mesh and a line graph from a .csv file. However, I am running into two errors- an error with the "colon operands must be real scalars" and that the "character vector is not terminated properly". Any help to fix these two errors would be greatly appreciated.
tot=imread('SUM_Test59_Top_Reslice.tif');
x = (1:1988)*1.3;
y = (1:2160)*1.3;
L1=tot*1.3;
mesh(y,x,L1);
colormap;
caxis([]);
xlabel('length[um]');
ylabel('length[um]');
xlim([0 max(x)])
ylim([0 max(y)])
m1=sum(L1(1:2160,:,'));
plot(m1);

Answers (1)

Charan Jadigam
Charan Jadigam on 3 Mar 2020
Hi,
I can see you are passing into ‘mesh’ data with different sizes, this would cause ‘Data dimensions must agree’ error.
The errors occur because of extra character in the m1=sum(L1(1:2160,:,')); statement. While calculating m1 using L1, the correct way of indexing would be,
m1=sum(L1(1:2160,:,:));

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!