plot N*N pane questions

I want to plot a N*N pane figure, N is an integer.Who know how can I do that? Thanks in advance; any comments will be appreciate.

6 Commenti

chengxuan yu
chengxuan yu il 18 Lug 2012
Frankly speaking, I want to write a program that can realize the "Memory Matrix". This is part of that. So I hope your help.
Walter Roberson
Walter Roberson il 18 Lug 2012
What is "Memory Matrix" in this context?
Would it work for your purposes to turn on grid lines with the ticks set 1 unit apart?
chengxuan yu
chengxuan yu il 20 Lug 2012
Modificato: Walter Roberson il 20 Lug 2012
I have already plot the pane. The programme is below.
a=ones(270,270);
a=a*25;
for i=1:10
a(max(1,(i-1)*30):max(1,(i-1)*30)+1,:)=0;
a(:,max(1,(i-1)*30):max(1,(i-1)*30)+1)=0;
end
figure;
imshow(a,[]);
The Memory Matrix is a way to improve one's memory.
Walter Roberson
Walter Roberson il 20 Lug 2012
Okay, so what is remaining for your question?
chengxuan yu
chengxuan yu il 23 Lug 2012
Sorry for the long time no come. Because my family has some circs. I just realize plot the pane. And I don't konw how to come true that game. I konw it should be progammed in GUI. But i should know the basic programme first. The following step that I want to konw is how to fill the N pane among the 10*10 pane to black? N is random. Thank you for your help first.
Image Analyst
Image Analyst il 23 Lug 2012
Modificato: Image Analyst il 23 Lug 2012
Hmmmm.... Looks like Google Translate didn't do such a good job on that one. Maybe if you reviewed some of Doug Hull's video tutorials ( http://blogs.mathworks.com/videos/) on GUI development you might learn how to do whatever it is that you want to do.

Accedi per commentare.

Risposte (1)

Walter Roberson
Walter Roberson il 23 Lug 2012
pane = zeros(10,10);
temp_idx_to_fill = randperm(numel(pane));
idx_to_fill = temp_idx_to_fill(1:N);
[row_to_fill, col_to_fill] = idx2sub(size(pane), idx_to_fill);
Now fill the locations at [row_to_fill(1), col_to_fill(1)], [row_to_fill(2), col_to_fill(2)] and so on.

2 Commenti

chengxuan yu
chengxuan yu il 25 Lug 2012
In your programme I didn't understand the function of idx2sub and matlab can not recognise it.
Walter Roberson
Walter Roberson il 25 Lug 2012
Sorry I should have written ind2sub() instead of idx2sub()

Accedi per commentare.

Richiesto:

il 18 Lug 2012

Community Treasure Hunt

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

Start Hunting!

Translated by