Here is one approach using simple loops and indexing. You will have to do some fine-tuning to get it to suit your requirements. A = [0,0,0;0,2,1;0,1,0]; % Input 3x3 matrix. % M = [... % base cube '~~~______~'; '~~/ /|'; '~/ / |'; '/_____/ |'; '| | /'; '| | /~'; '|_____|/~~']; % Sa = size(A); Sm = size(M); Xm = M~='~'; Xr = cell(Sa); Xc = cell(Sa); % Generate indices: for ii = 1:Sa(1) % back -> front. for jj = 1:Sa(2) % left -> right. for kk = 1:A(ii,jj) % bottom -> top. R = ii*3 - kk*3; C = jj*6 - ii*3 - kk; % try without kk. Xr{ii,jj} = [Xr{ii,jj};R+1-Sm(1):R]; Xc{ii,jj} = [Xc{ii,jj};C+1-Sm(2):C]; end end end % Normalize indices: Xr = vertcat(Xr{:}); Xc = vertcat(Xc{:}); Xr = 1+Xr-min(Xr(:)); Xc = 1+Xc-min(Xc(:)); % Place cube at required locations: Z = repmat(' ',max(Xr(:)),max(Xc(:))); for nn = 1:sum(A(:)) tmp = Z(Xr(nn,:),Xc(nn,:)); tmp(Xm) = M(Xm); % keep char outside the cube. Z(Xr(nn,:),Xc(nn,:)) = tmp; end disp(Z) Displays this in the command window: ______ / /| / / | /_____/ |______ | | / /| | | / / | |______/_____/ | / /| | / / / | | / /_____/ |_____|/ | | / | | / |_____|/ Tested with the first example input matrix: >> A = [0,0,0;0,1,1;0,0,0] A = 0 0 0 0 1 1 0 0 0 Giving ____________ / / /| / / / | /_____/_____/ | | | | / | | | / |_____|_____|/ Answer from Stephen23 on mathworks.com
๐ŸŒ
MathWorks
mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 403928-how-to-make-a-3x3-matrix
How to make a 3x3 matrix - MATLAB Answers - MATLAB Central
June 4, 2018 - Open in MATLAB Online ยท Hello every one; I want to make a 3x3 general matrix using three different function as shown in code. It is working but I want to know how to save the results in three different lines of same matrix. Also how to run this matrix in command window for some defined value of theta.
๐ŸŒ
MathWorks
mathworks.com โ€บ matlab โ€บ mathematics โ€บ linear algebra
Basic Matrix Operations - MATLAB & Simulink Example
MATLAB has many applications beyond just matrix computation. To convolve two vectors ... ... At any time, we can get a listing of the variables we have stored in memory using the who or whos command. ... Name Size Bytes Class Attributes A 3x3 72 double B 3x3 72 double C 3x3 72 double a 1x9 72 double ans 3x1 24 double b 3x1 24 double p 1x4 32 double q 1x7 56 double r 1x10 80 double x 3x1 24 double
๐ŸŒ
MathWorks
mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 285210-define-a-matrix-3x3-using-matlab
Define a Matrix 3x3 using matlab - MATLAB Answers - MATLAB Central
May 20, 2016 - I'm tryin to define a 3x3 matrix using matlab but I get an error: Undefined function or variable 'A'. Here's my code: J := matrix([[-(l1+q2)*sind(q1)-l3*sind(q1+q2), cosd(q1), -l3*sind(q1+q3)...
๐ŸŒ
MathWorks
mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 481257-how-to-turn-assigned-vectors-into-a-3x3-matrix
How to turn assigned vectors into a 3x3 matrix? - MATLAB Answers - MATLAB Central
September 20, 2019 - If your vec3 is not a typo, then you have too many elements in vec3 to make it part of the 3x3 matrix. ... https://www.mathworks.com/matlabcentral/answers/481257-how-to-turn-assigned-vectors-into-a-3x3-matrix#comment_747930
๐ŸŒ
MathWorks
mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 1855773-how-to-make-a-3x3-matrix-a-9x1-matrix
how to make a 3x3 matrix a 9x1 matrix? - MATLAB Answers - MATLAB Central
November 18, 2022 - Further, you can know this, if you understand how the elements are stored in MATLAB matrices. A matrix in MATLAB stores the elements going down each column, one at a time. Since reshape does not change the order of the elements in a matrix, then you need to do that FIRST.
๐ŸŒ
MathWorks
mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 272653-loop-to-create-3x3-matrix-for-each-frame
loop to create 3x3 matrix for each frame - MATLAB Answers - MATLAB Central
March 10, 2016 - Hi I want to build a 3x3 Matrix from 3 vectors. R.fcsR = [Xn.fcsR; Yn.fcsR; Zn.fcsR]; I have captured a movement of a point over 247 frames. How can I make a for loop, so that for every ...
Find elsewhere
๐ŸŒ
MathWorks
mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 397470-how-to-generate-all-the-3-by-3-matrices
How to generate all the 3 by 3 matrices ? - MATLAB Answers - MATLAB Central
April 26, 2018 - You want to create all 16 billion of them. Each matrix is a 3x3 matrix. In the form of a double, that will take up 9*8=72 bytes to store. So the entires set of roughly 16 billion matrices will require something like 1152 gigabytes of memory to store.
๐ŸŒ
MathWorks
mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 266106-how-do-i-divide-a-3x3-matrix-in-three-vertical-or-horizontal-one-dimensional-vectors-using-a-functio
How do I divide a 3X3 matrix in three vertical or horizontal one-dimensional vectors using a FUNCTION? - MATLAB Answers - MATLAB Central
February 1, 2016 - Just wanted to know how do I create a function which accepts a 3X3 matrix and returns three declared arrays from the vectors elements in the rows and columns. Can anyone help? (MATLAB beginner btw)
๐ŸŒ
MathWorks
mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 501303-3x3-matrix-with-while-loop
3x3 matrix with while loop - MATLAB Answers - MATLAB Central
January 21, 2020 - Produce a random 3x3 matrix A that is invertible and display it. Hint: Use a while-loop until you get one with non-zero determinant. To create a random matrix with N rows and M columns,use the MATLAB command rand(N,M).
๐ŸŒ
MathWorks
mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 496929-how-to-run-a-3x3-matrix-through-a-for-loop-and-save-all-instances-of-the-3x3
how to run a 3x3 matrix through a for loop and save all instances of the [3x3] - MATLAB Answers - MATLAB Central
December 18, 2019 - This returns a 300x1 cell for y. This 300x1 cell contains 300 3x300 doubles but I am trying to get 300 3x1 doubles. So I think I am very close to my final output, it may be an error in my matrix multiplication, thank you for your help and insight. ... https://www.mathworks.com/matlabcentral/answers/496929-how-to-run-a-3x3-matrix-through-a-for-loop-and-save-all-instances-of-the-3x3#comment_779012
๐ŸŒ
MathWorks
mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 497739-how-to-create-a-matrix-3-3-from-1-to-9-by-using-for-loop
how to create a matrix (3*3) from 1 to 9 by using for loop - MATLAB Answers - MATLAB Central
December 22, 2019 - How to create a matrix (3*3) from 1 to 9 by using For loop like: 1 2 3 4 5 6 7 8 9 ................. for i=1:3 %row% for j=1:3 %column% a(i,j)= input('a='); end end...
๐ŸŒ
MathWorks
mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 1750690-how-to-store-multiple-iterations-of-a-3x3-matrix-using-a-for-loop
How to store multiple iterations of a 3x3 matrix using a for loop. - MATLAB Answers - MATLAB Central
June 29, 2022 - Below is a piece of my foor loop that I have created to generate Cpp_p_extrap (accoridng to rules not included in this). My goal is to create and store n iterations of the "Cpp_p_extrap" matrix. Im...