Quote:
Originally Posted by bobthecockroach Spec says ask for another number, so you'll need to loop the whole thing too. |
Thanks, I missed that part. I've revised it to include that spec.
I took a look at the second part of the lab and it makes absolutely no sense to me. I am given a 6x5 matrix of 1s and 0s. I have to create a program that draws a red square if the number is a 1 and a red square if the number is zero. They give me a "template" for the code, but I can't make heads or tails out of it. Here's the template code they give me.
function lab4program2
level_map = [0 0 0 0 0;0 1 0 1 0;1 0 1 0 1; 0 1 0 1 0;0 0 1 0 0];
map_size = size(level_map);
a = axes();
axis(a,[0,6,0,6]);
hold on;
%your loop goes here
end
%draws a square on axes, a, at location x,y with radius r, and 3 element
%color, e.g. [0,0,1] for blue, or [1,0,0] for red
function draw_square(a,x,y,r,c)
plot([x-r,x-r,x+r,x+r,x-r],[y+r,y-r,y-r,y+r,y+r],'-','parent',a,'color',c);
end
Any help would be greatly appreciated guys!
__________________
"Always out-manned, never out-gunned"
"The most dangerous weapon in the world is a US Marine and his rifle."
"The Marines know how to use their bayonets. The Army's bayonets might as well be used as paper weights."
"It's God's job to judge the terrorists. It's the Marines job to arrange the meeting."
My friends blog (with a few random posts by me!)