🌐
MathWorks
mathworks.com › matlab › programming › functions › scope variables and generate names
persistent - Define persistent variable - MATLAB
Persistent variables are similar to global variables because MATLAB creates permanent storage for both. They differ from global variables because persistent variables are known only to the function that declares them.
🌐
MathWorks
mathworks.com › simulink › block and blockset authoring › author block algorithms › author blocks using matlab › author blocks using matlab functions › matlab function block basics
Initialize Persistent Variables in MATLAB Functions - MATLAB & Simulink
A persistent variable is a local variable in a MATLAB® function that retains its value in memory between calls to the function. If you generate code from your model, you must initialize a persistent variable for your MATLAB functions.
🌐
MathWorks
mathworks.com › hdl coder › high-level synthesis code generation from matlab › matlab algorithm design › matlab language support
Map Persistent Variables and Persistent Arrays to RAM - MATLAB & Simulink
You can use persistent variables to model registers. For example, to preserve the state between invocations of your MATLAB® algorithm, use persistent variables.
🌐
Northwestern University
ece.northwestern.edu › local-apps › matlabhelp › techdoc › ref › persistent.html
persistent (MATLAB Functions)
persistent X Y Z defines X, Y, and Z as variables that are local to the function in which they are declared yet their values are retained in memory between calls to the function. Persistent variables are similar to global variables because MATLAB creates permanent storage for both.
🌐
MathWorks
mathworks.com › matlabcentral › answers › 240690-using-the-persistent-function
Using the persistent function - MATLAB Answers - MATLAB Central
September 7, 2015 - - this is where I originally started but got lost and started to resort to using the persistent variable ... It's unclear what difficutly you're encountering with passing values between functions. This is usually straightforward. ... Sign in to comment. Sign in to answer this question. Find more on Whos in Help Center and File Exchange ... Find the treasures in MATLAB Central and discover how the community can help you!
🌐
MathWorks
mathworks.com › simulink real-time › model preparation for real-time execution › i/o connectivity › execution parameters
Apply Persistent Variables in Real-Time Applications - MATLAB & Simulink
At real-time application start, ... Read blocks. In MATLAB®, you can get or set the values of persistent variables on the target computer by using the getPersistentVariables function and the setPersistentVariables function....
🌐
MathWorks
mathworks.com › matlab coder › matlab algorithm acceleration
Generate Code for Persistent Variables - MATLAB & Simulink
By default, codegen generates a MEX function named compute_average_mex in the current folder. This allows you to test the MATLAB code and MEX function and compare the results. ... Clear the persistent variables by using the clear mex command.
🌐
Johns Hopkins University
math.jhu.edu › ~shiffman › 370 › help › techdoc › ref › persistent.html
persistent (MATLAB Function Reference)
Description persistent X Y Z defines X, Y, and Z as persistent in scope, so that X, Y, and Z maintain their values from one call to the next. persistent can be used within a function only. Persistent variables are cleared when the M-file is cleared from memory or when the M-file is changed.
🌐
MathWorks
mathworks.com › hdl coder › hdl code generation from simulink › hdl modeling guidelines › guidelines for supported blocks and data type settings
Using Persistent Variables and fi Objects Inside MATLAB Function Blocks for HDL Code Generation - MATLAB & Simulink
To make sure that the persistent variables inside the MATLAB Function block map to a register on the target FPGA device, update the persistent variable at the end of the MATLAB® code inside the MATLAB Function block.
Find elsewhere
🌐
MathWorks
mathworks.com › simulink real-time › control and instrumentation › control and instrumentation with matlab › use matlab language to create and execute a real-time application
setPersistentVariables - Set persistent variables from MATLAB to the Simulink Real-Time target computer - MATLAB
setPersistentVariables(target_object,variables_struct) sets persistent variables to values from variables on the MATLAB® development computer into the persistent variables on the Speedgoat® target computer.
🌐
MathWorks
mathworks.com › simulink real-time › control and instrumentation › control and instrumentation with matlab › use matlab language to create and execute a real-time application
getPersistentVariables - Get persistent variables from the Simulink Real-Time target computer to MATLAB - MATLAB
variables_struct = getPersistentVariables(target_object) gets persistent variables values from the persistent variables on the Speedgoat® target computer and places these values into a structure of MATLAB variables on the MATLAB® development computer.
🌐
MathWorks
mathworks.com › hdl coder › hdl code generation from matlab › matlab algorithm design › system objects
Model State with Persistent Variables and System Objects - MATLAB & Simulink
This example shows how to use persistent variables and System objects to model state and delays in a MATLAB® design for HDL code generation.
🌐
Reddit
reddit.com › r/matlab › is there a speed difference between global and persistent variables? on that note, is there a breakdown of variable access speeds?
r/matlab on Reddit: Is there a speed difference between global and persistent variables? On that note, is there a breakdown of variable access speeds?
August 25, 2012 -

I know accessing something from a class is slower than a struct, but I'm looking for more info.

I'm writing a small gui that is going to give status updates as my program is running. Because messages are logged often in my code it actually slows down performance. What I did is implemented a buffer and only write the buffer to the gui whenever X messages have been logged. This seems to be doing ok, but I'm just curious about how matlab is put together.

🌐
MathWorks
mathworks.com › matlabcentral › answers › 254121-does-persistent-variable-help-speed
Does "persistent variable" help speed? - MATLAB Answers - MATLAB Central
August 15, 2015 - I do not think so. In fact, using temp (not persistent) variables could possibly be optimized internally by Matlab to use registers/stack, which would be faster than using main memory (heap) as is the case for persistent/global vars.