Error: The expression to the left of the equals sign is not a valid target for an assignment.
2 次查看(过去 30 天)
显示 更早的评论
For some unknown reason I am getting this error on every line past line 14 (deleting the line causes the error to jump to the next line). Any help would be very much appreciated.
clear, clc
%Read image
img=im2double(imread('axial_CT_slice.bmp'));
[X, Y]=size(img);
%Set two seeds
s1x=130; s1y=150; %Note that seed location is not central to object
s2x=200; s2y=200;
seeds = [sub2ind([X Y],s1y,s1x),sub2ind([X Y]);
%Apply the random walker algorithms
%Build graph
%Generate points
rangex = 0:(X-1); %<- where the error is now
rangey = 0:(Y-1);
[x, y]=meshgrid(rangey,rangex);
points=[x(:),y(:)]; %cont.
0 个评论
回答(2 个)
Jon
2015-9-23
编辑:Jon
2015-9-23
I can't figure out why you're getting an error, but it works if you put square brackets around the expression, like this
rangex = [0:(X-1)];
EDIT: that actually doesn't work. You're not closing your seeds = [stuffhere bracket. Ie, it should read
seeds = [sub2ind([X Y],s1y,s1x),sub2ind([X Y])];
0 个评论
Walter Roberson
2015-9-23
Why are you calling sub2ind([X Y]) without the expected multiple arguments?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 3-D Volumetric Image Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!