Asked by VISWANATH
on 5 May 2011

Hello all,

I have a problem, trying to solve it for the last two days, but could not succeed. ANY HELP WOULD BE GREATLY APPRECIATED.

I have a data in txt file called 'ecoli'. The first column and first row are wavelength parameters.

The rest of the matrix contains intensity values.

here is what i have done. I have deleted first element in first column and row because it was a X/Y text parameter.

Then i have reduced matrix by deleting first column and row, to get the rest of the intensity value matrix.

X=ecoli(:,1);

>> Y=ecoli(1,:);

>> ind=[1]

ind =

1

>> X(ind)=[]; >> Y(ind)=[]; >> ecoli(:,1)=[]; >> ecoli(1,:)=[]; >> Z=ecoli; >> plot3(X,Y,Z);

I get this error.

??? Error using ==> plot3 Vectors must be the same lengths.

Could somebody through some light on this problem. I know some where the lengths of vectors are not same thats y i could not plot.

Thanks

Answer by Sean de Wolski
on 5 May 2011

Accepted Answer

Ecoli - fun stuff

size(X)

size(Y)

size(Z)

which one is different and why?

Teja Muppirala
on 6 May 2011

if isequal({size(X) size(Y) size(Z)},{[381 1] [1 77] [381 77]})

[Xgrid,Ygrid] = meshgrid(X,Y);

surf(X,Y,Z') %<-- Transpose because your data has X vertical, Y horizontal

else

disp('Your sizes are not correct.')

end

Teja Muppirala
on 6 May 2011

Oops, I guess I didn't really need to put that meshgrid line in there

VISWANATH
on 6 May 2011

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.