Mastering Programming with MATLAB: (14) Vectorization and Other Speed up

Описание к видео Mastering Programming with MATLAB: (14) Vectorization and Other Speed up

I am here to help you with your questions. Please send your queries at: [email protected]

Vectorization is one of the core concepts of MATLAB. With one command it lets you process all elements of an array, avoiding loops and making your code more readable and efficient.

For data stored in numerical arrays, most MATLAB functions are inherently vectorized. Often, however, your data may not be stored in a simple numerical array. Instead, it could be stored in cell arrays, structures, or structure arrays. For example:

You may have a cell array containing both string and non-string data, and need to know which elements of the array are strings and which are not.
You may have a structure array, and need to know which elements contain data above a given threshold.
You may have sensor data stored in a structure where each field of the structure corresponds to data for a particular sensor, and need to compute the standard deviation for each sensor, or need to "clean" the data by removing any NaN values.
You may have a structure array filled with data that corresponds to the locations of various tokens (or substrings) in multiple files, with each file containing multiple lines of text (for example, M-code), and you need to present the data in a relatively transparent format.

Комментарии

Информация по комментариям в разработке