Insights Blog
-- Browse All Articles --
Physics Articles
Physics Tutorials
Physics Guides
Physics FAQ
Math Articles
Math Tutorials
Math Guides
Math FAQ
Education Articles
Education Guides
Bio/Chem Articles
Technology Guides
Computer Science Tutorials
Forums
General Math
Calculus
Differential Equations
Topology and Analysis
Linear and Abstract Algebra
Differential Geometry
Set Theory, Logic, Probability, Statistics
MATLAB, Maple, Mathematica, LaTeX
Trending
Featured Threads
Log in
Register
What's new
Search
Search
Search titles only
By:
General Math
Calculus
Differential Equations
Topology and Analysis
Linear and Abstract Algebra
Differential Geometry
Set Theory, Logic, Probability, Statistics
MATLAB, Maple, Mathematica, LaTeX
Menu
Log in
Register
Navigation
More options
Contact us
Close Menu
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Forums
Mathematics
MATLAB, Maple, Mathematica, LaTeX
MatLab: Understanding the Size Command
Reply to thread
Message
[QUOTE="Wrichik Basu, post: 6118884, member: 623143"] When you are doing ##size(A, 1)## or ##size(A, 2)##, 1 and 2 are [B]dimensions[/B] here, not the row or column. Since the array is 3×3 (a two-dimensional matrix), the 1st dimension is 3, and the second is 3. If you create a 3×3×3 matrix (a three-dimensional matrix), the 3rd dimension would be 3, but any higher order dimensions would be 1. As a basic rule, if an array ##A## is n-dimensional, then ##size(A, dim)## returns the size of that [B]dimension[/B]. If ##dim## exceeds ##n##, then 1 is returned. Since you've created a two-dimensional array, all command that use dimensions > 2 return 1. Try this and let me know whether you understand the output (don't copy and paste, as that often generates wrong outputs): [code="Matlab"]A = ones(2, 3, 4); [sz1 sz2 sz3] = size(A) [sz1 sz2 sz3 sz4 sz5] = size(A)[/code] Read more [URL='https://in.mathworks.com/help/matlab/ref/size.html#bvfgzsm-7']here[/URL]. [SIZE=2]Edit: Grammar and formatting.[/SIZE] [/QUOTE]
Insert quotes…
Post reply
Forums
Mathematics
MATLAB, Maple, Mathematica, LaTeX
MatLab: Understanding the Size Command
Back
Top