How can I create a 3D matrix with values every 3rd/6th/9th row?
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
How can I make my 3d city have rows every 3rd/6th/9th row?
% Create the height of your buildings
A=rand(11,11)
% Make roads have 0 height
A(3,1:11)=0
A(6,1:11)=0
A(9,1:11)=0
% Make roads have 0 height
A(1,11:3)=0
A(1,11:6)=0
A(1,11:9)=0
4 Kommentare
Youssef Khmou
am 6 Feb. 2013
hi, i suggest that you change the title of your question, and make it a bit professional even for numerical drawing, so as to get responses from professionals .
Image Analyst
am 6 Feb. 2013
Bearbeitet: Image Analyst
am 7 Feb. 2013
Then change the body so that people can understand what you want to do. For example, what does "have rows every 3rd/6th/9th row" mean???? Evidently from your code you meant "have zeros every 3rd row". Did you proofread your question before you posted it?
Finally learn to format your code. Highlight your code, then click the {}Code icon above the text box.
By the way, your new subject line "3D model I ling" makes as little sense as your last one. What is a "ling"?
Jan
am 8 Feb. 2013
How annoying - another deleting of the question. Sean, the frequent contributor will loose the interest in answering your questions, if you invalidate the threads afterwards. This is a destructive behavior in a public forum.
Randy Souza
am 12 Feb. 2013
I have restored the original text of this question.
Sean, this question may be valuable to someone else in the future. If you have a good reason why it should be removed from MATLAB Answers, please flag the question, explain why it should be deleted, and an administrator or high-reputation contributor will consider deleting the question. Please do not simply edit your question away.
Antworten (2)
Youssef Khmou
am 7 Feb. 2013
Bearbeitet: Youssef Khmou
am 7 Feb. 2013
hi, for the second time ,re-write your question, anyway based on your non organized question, here is what you ask for :
N=11;
a=rand(N);
for i=1:N
if mod(i,3)==0
a(i,:)=0;
end
end
But this is not what you wanted, you wanted when surfing the matrix a , to see "parallelepipeds" as buildings , you repost the question with proper description .
Youssef Khmou
am 12 Feb. 2013
clc,
close all
N=11;
a=rand(N);
for i=1:N
if mod(i,3)==0
a(i,:)=0;
a(:,i)=0;
end
end
fprintf(' Original city :\n');
a
figure, surf(a), colormap gray, view(-36,86), axis off
fprintf('\n after years of civilization , the city became :\n')
building=ones(20);
b=kron(a,building);
b(1,:)=0;
b(:,1)=0;
b(end,:)=0;
b(:,end)=0;
figure, surf(b,'AmbientStrength',0.85), xlabel(' Streets');
ylabel(' Streets'), title(' Sean''s CITY'), axis off,view(93,4)
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!