MATLAB: Displaying a cube of 255x255x255

cube

I am new to the programming and the Matlab environment.
I created a cube of ones of size 255x255x255. The code:
for i = 1:255
for j = 1:255
for k = 1:255
f(i,j,k) = 1;
end
end
end
When I use the command imshow(f), the Matlab is giving me the error "mismatched dimension".
Can somebody please suggest me if this is the correct way of doing?
Thank you.

Best Answer

V = false(257,257,257);
V(2:end-1,2:end-1,2:end-1) = true; %True cube with one exterior layer of false
patch(isosurface(V,0)) %plot 'er