| Contents | Index |
To make structures persist, you define them to be persistent variables and initialize them with the isempty statement, as described in Defining and Initializing Persistent Variables.
For example, the following function defines structure X to be persistent and initializes its fields a and b:
function f(u) %#codegen persistent X if isempty(X) X.a = 1; X.b = 2; end
![]() | Defining Arrays of Structures for Code Generation | Indexing Substructures and Fields | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |