As you know, matlab deals mainly with matrices. So, the size function gives you the dimension of a matrix depending on how you use it. For example:
1. If you say size(A), it will give you a vector of size 2 of which the first entry is the number of rows in A and the second entry is the number of columns in A.
2. If you call size(A, 1), size will return a scalar equal to the number of rows in A.
3. If you call size(A, 2), size will return a scalar equal to the number of columns in A.

A scalar like scale in your example is considered as a vector of size 1 by 1. So, size(scale, 2) will return 1, I believe.

Hope this clarifies.

Answer from Divya on Stack Overflow
🌐
MathWorks
mathworks.com › matlab › language fundamentals › matrices and arrays
size - Array size - MATLAB
You can specify dim as a vector of positive integers to query multiple dimension lengths at a time. Alternatively, you can list the queried dimensions as separate input arguments dim1,dim2,...,dimN. For an example, see Size of 4-D Array. length | strlength | ndims | numel | height | width · You clicked a link that corresponds to this MATLAB command:
🌐
MathWorks
mathworks.com › instrument control toolbox › driver-based instrument communication › generic instrument drivers
size - Size of instrument object array - MATLAB
m = size(obj,dim) returns the length of the dimension specified by the scalar dim. For example, size(obj,1) returns the number of rows. ... Run the command by entering it in the MATLAB Command Window.
🌐
MathWorks
mathworks.com › mapping toolbox › data analysis › vector data
size - Return size of geographic or planar vector - MATLAB
Size of vector v in the second dimension, returned as the value 1. ... Run the command by entering it in the MATLAB Command Window.
🌐
MathWorks
mathworks.com › matlab › programming › classes › define classes › class hierarchies › subclass applications
Use of size and numel with Classes - MATLAB & Simulink
The size and numel functions work consistently with arrays of user-defined objects. There is generally no need to overload size or numel in user-defined classes. Several MATLAB® functions use size and numel to perform their operations.
🌐
Johns Hopkins University
math.jhu.edu › ~shiffman › 370 › help › techdoc › ref › size.html
size (MATLAB Function Reference)
d = size(rand(2,3,4)) d = 2 3 4 Here the size of each dimension is assigned to a separate variable.
🌐
MathWorks
mathworks.com › matlab › mathematics › elementary math › arithmetic operations
Compatible Array Sizes for Basic Operations - MATLAB & Simulink
Most binary (two-input) operators and functions in MATLAB® support numeric arrays that have compatible sizes. Two inputs have compatible sizes if, for every dimension, the dimension sizes of the inputs are either the same or one of them is 1. In the simplest cases, two array sizes are compatible if they are exactly the same or if one is a scalar.
🌐
Rdrr.io
rdrr.io › cran › matlab › man › size.html
size: MATLAB size function in matlab: 'MATLAB' Emulation Package
July 1, 2024 - / matlab · / size: MATLAB size function · Provides dimensions of X. size(X, dimen) This is an S4 generic function. Vector will be treated as a single row matrix. Stored value is equivalent to dim. Returns object of class size_t containing the dimensions of input argument X if invoked with ...
Find elsewhere
🌐
MathWorks
mathworks.com › statistics and machine learning toolbox › descriptive statistics and visualization › managing data
dataset.size - (Not Recommended) Size of dataset array - MATLAB
The dataset data type is not recommended. To work with heterogeneous data, use the MATLAB® table data type instead. See MATLAB table documentation for more information. D = SIZE(A) [NOBS,NVARS] = SIZE(A) [M1,M2,M3,...,MN] = SIZE(A) M = size(A,dim)
🌐
MathWorks
mathworks.com › system identification toolbox › model analysis › data extraction
size - Query output/input/array dimensions of input–output model and number of frequencies of FRD model - MATLAB
When invoked without output arguments, size(sys) returns a description of type and the input-output dimensions of sys. If sys is a model array, the array size is also described. For identified models, the number of free parameters is also displayed.
🌐
MathWorks
mathworks.com › system identification toolbox › data preparation › represent data
size - Determine size of iddata data set - MATLAB
[ns,ny,nu,ne] = size(data) returns, for the iddata object data, the number of data samples ns in each experiment, the number of outputs ny, the number of inputs nu, and the number of experiments ne.
🌐
MathWorks
mathworks.com › matlab › data import and analysis › data preprocessing
resize - Resize data by adding or removing elements - MATLAB
This MATLAB function resizes A to size m by adding elements to or removing elements from the trailing side of A.
🌐
MathWorks
mathworks.com › simulink › block and blockset authoring › author block algorithms › author blocks using matlab › author blocks using matlab functions › variables in matlab function blocks
Specify Size of MATLAB Function Block Variables - MATLAB & Simulink
For example, to define a column vector of size 6, set the Size property to [6 1]. To define a row vector of size 5, set the Size property to [1 5]. To define a matrix of data size 3-by-3, set the Size property to [3 3]. Before R2021b: MATLAB Function blocks output column vectors as one-dimensional data.
🌐
Quora
quora.com › What-is-the-difference-between-length-and-size-in-MATLAB
What is the difference between length and size in MATLAB? - Quora
Actually, MATLAB has a wide help library that also contains good examples to illustrate difference between length and size functions. “size” gives length of all matrix dimension, whereas “length” gives your Length of largest array dimension.
🌐
EDUCBA
educba.com › home › data science › data science tutorials › matlab tutorial › size function in matlab
Size Function in MATLAB | Top Examples of Size Function in MATLAB
February 28, 2023 - Size function in MATLAB will return a row vector, whose elements will be the size of the respective dimensions of the array passed in the input.
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
MathWorks
mathworks.com › matlab › language fundamentals › data types › dictionaries
size - Size of Map object - MATLAB
sz = size(M) sz = 1×2 4 1 · collapse all · Input Map object. Queried dimension, specified as a positive numeric scalar. Introduced in R2008b · dictionary | containers.Map | isKey | keys | length | values · Map Data with Dictionaries · You clicked a link that corresponds to this MATLAB ...
🌐
MathWorks
mathworks.com › matlabcentral › answers › 869063-sizeof-double-float-int-etc
Sizeof double float int etc - MATLAB Answers - MATLAB Central
June 30, 2021 - Why? If you're trying to create an array to be filled in, just call a function like ones or zeros and tell it the size of the array you want to create (in terms of number of elements) and optionally the type.