Filter löschen
Filter löschen

Width function on arrays

14 Ansichten (letzte 30 Tage)
mlam
mlam am 7 Sep. 2015
Bearbeitet: Stephen23 am 15 Okt. 2020
How do i use the width or height functions on a 3d array? For example, the array information i am using is that of a picture.

Antworten (1)

Stephen23
Stephen23 am 7 Sep. 2015
Bearbeitet: Stephen23 am 15 Okt. 2020
MATLAB does not have width or height functions for normal arrays. You can use size to get the size of an array:
d = size(X)
[m,n,p,~] = size(X)
m = size(X,dim)
You can select the dimension using the optional second argument:
rows = size(X,1)
cols = size(X,2)
pages = size(X,3)
You might like to read about multidimensional arrays to know how these are defined and accessed.
For the new data class tables you can use the width function to get how many variables there are in the table, and height to get the number of rows of the table.
  3 Kommentare
f
f am 15 Okt. 2020
Just for future reference: as of R2020b, I think width and height have been added for arrays: https://it.mathworks.com/help/matlab/ref/width.html?s_tid=srchtitle
Stephen23
Stephen23 am 15 Okt. 2020
Bearbeitet: Stephen23 am 15 Okt. 2020

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by