MATLAB Programming Fundamentals - MathWorks
end [c1,c2,c3,c4,c5,c6] = C{1,1:6}; c5 c5 = 34 If you specify fewer output variables than the number of outputs returned by the ...
ans = 3 78 Use deal to overwrite each element in the list. [c{:}] = deal([10 20],[14 12]); c{:} ans = 10 20 ans = 14 12 This exa ...
ans = 14 12 How to Use the Comma-Separated Lists Common uses for comma-separated lists are “Constructing Arrays” on page 2-83 “ ...
Displaying Arrays Use a list to display all or part of a structure or cell array: A{:} ans = Hello ans = [2] [10] [18] [26] [34] ...
This example passes several attribute-value arguments to the plot function: X = -pi:pi/10:pi; Y = tan(sin(X)) - sin(tan(X)); C = ...
function y = fftshift(x) numDims = ndims(x); idx = cell(1,numDims); for k = 1:numDims m = size(x,k); p = ceil(m/2); idx{k} = [p+ ...
Alternatives to the eval Function In this section... “Why Avoid the eval Function?” on page 2-87 “Variables with Sequential Name ...
numArrays = 10; A = cell(numArrays,1); for n = 1:numArrays A{n} = magic(n); end Access the data in the cell array by indexing wi ...
You can construct file names within a loop using the sprintf function (which is usually more efficient than int2str), and then c ...
fieldName = input('Select data (height or weight): ','s'); dataToUse = myData.(fieldName); If you enter weight at the input prom ...
Classes (Data Types) 91 ...
...
Overview of MATLAB Classes 3 ...
Fundamental MATLAB Classes There are many different data types, or classes, that you can work with in the MATLAB software. You c ...
You can create two-dimensional double and logical matrices using one of two storage formats: full or sparse. For matrices with m ...
Class Name Documentation Intended Use logical “Logical Operations” Use in relational conditions or to test state. Can have one ...
Class Name Documentation Intended Use cell “Cell Arrays” • Cells store arrays of varying classes and sizes. Allows freedom to p ...
...
Numeric Classes “Integers” on page 4-2 “Floating-Point Numbers” on page 4-7 “Complex Numbers” on page 4-17 “Infinity and NaN” o ...
Integers In this section... “Integer Classes” on page 4-2 “Creating Integer Data” on page 4-3 “Arithmetic Operations on Integer ...
«
3
4
5
6
7
8
9
10
11
12
»
Free download pdf