Display Aerotech Position in App Designer

I'm attempting to display the position feedack of axes from Aerotech Motion Composer. The position parameter is in a matlab function I call AxisPositions where the relevant line of code is:
posXFeedback = A3200StatusGetItem(handle, 0, A3200StatusItem.PositionFeedback, 0);
I want to grab this value continuously in real time and display in an Edit Field (or any appropriate component) in an App Designer GUI.
In App Designer I have an Edit Field where I have attempted to call the posXFeedback variable to be displayed as the value:
function PresentXposEditFieldValueChanged(app, event)
app.PresentXposEditField.Value = AxisPositions;
end
Can anyone suggest how to approach this?
Thanks in advance.

Antworten (1)

Aghamarsh Varanasi
Aghamarsh Varanasi am 18 Jun. 2021

0 Stimmen

Hi,
You can use a timer-class to execute a function after a particular time interval. This will help you to query and display the position feedback from Aerotech Motion Composer at specific intervals of time. For reference, you can check this app designer example that uses a timer-based data update.
Note that in your case, you can choose an appropriate period (as low as 0.01 sec) to make the updates seem real time.
Hope this helps

2 Kommentare

Richard Wright
Richard Wright am 20 Jun. 2021
Thank you. This does give me much more direction.
Attempted code does not work yet but appears to be in the right direction.
methods (Access = public)
function t = UPDATER(app)
t = timer;
t.UserData = secondsBreak;
t.StartFcn = @Axispositions;
t.Period = .01;
t.TasksToExecute = Inf;
t.ExecutionMode = 'fixedRate';
t.TimerFcn = @PresentXposEditFieldValueChanged;
start(t)
end
Richard Wright
Richard Wright am 21 Jun. 2021
Bearbeitet: Richard Wright am 21 Jun. 2021
Perhaps displaying values in realtime cannot be done with the NumericEditField. Maybe a different component is needed. According to documentation about callbacks:
Value changed callback, specified as one of these values:
  • A function handle.
  • A cell array in which the first element is a function handle. Subsequent elements in the cell array are the arguments to pass to the callback function.
  • A character vector containing a valid MATLAB expression (not recommended). MATLAB evaluates this expression in the base workspace.
The callback executes when the user changes text in the edit field and either presses Enter or clicks outside the edit field. It does not execute if the edit field value changes programmatically.
This callback function can access specific information about the user’s interaction with the edit field. MATLAB passes this information in a ValueChangedData object as the second argument to your callback function. In App Designer, the argument is called event. You can query the object properties using dot notation. For example, event.PreviousValue returns the previous value of the edit field. The ValueChangedData object is not available to callback functions specified as character vectors.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Graphics Objects finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2021a

Gefragt:

am 15 Jun. 2021

Bearbeitet:

am 21 Jun. 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by