Matlab variable viewer does not update structure variables
Ältere Kommentare anzeigen
I have been saving data in structures and with my version of Matlab (2025B) it does not seem to update these variables in the viewer. I am currently developing some scripts, so I am essentially just running all the code from the command line. I don't think the code is important; it allocates matrices in a structure based on the data it reads in, and then calculates what the values are. Some psuedo code is below:
NewData='DataSet_X';
Data.(NewData).Value=zeros(size(X,1),2);
for I=1:length(X)
[Data.(NewData).Value(I,1),Data.(NewData).Value(I,2)] = ValueCalcFunction(Dataset X, Ith row)
end
Anyway, if I have Data open in the Variables window It shows the Value field as a matrix full of zeros even after it has been updated. If I double click the field and open just it in the variable window, it shows that it has been updated with the correct values. It would be nice to see it in the structure variable... Here is a screen capture that demonstrates what I mean:

Any ideas how can I force a refresh of the variable viewer?
I have a similar problem with the workspace not updating, but I found I can update it by pressing F5 or chosing Refresh from the menu. These options are not available in the variable viewer.
Thanks!
4 Kommentare
VBBV
am 4 Mai 2026 um 2:00
@Alan Hoskins Is the pseudo code which you shown present inside another loop ? In that case you would view the variable values as all zeros first before it updates the variable with values
Alan Hoskins
am 4 Mai 2026 um 3:07
Mathieu NOE
am 4 Mai 2026 um 11:52
have you tried one of these commands :
- refresh — Redraws and updates the current figure or UI, which can also trigger the Variables Editor to update.
- refreshdata — Updates plotted data and linked variables.
Alan Hoskins
am 4 Mai 2026 um 16:51
Antworten (1)
Samar
am 7 Mai 2026 um 7:30
0 Stimmen
Hi Alan,
I understand "Variable Viewer" is not refreshing in MATLAB R2025b and you want a method to force refresh it. This is a known issue and has been discussed in detail in the MATLAB Central Answers here: https://in.mathworks.com/matlabcentral/answers/2180404-cannot-open-variables-from-workspace-in-2025a-b
In the discussion it has been observed that is issue is not consistent and there is no fix as of now. Although there is a workaround that solves the problem. The workaround is to regenerate your MATLAB preferences. You can follow the steps mentioned in the MATLAB Central Answers link here which is answered by MathWorks Staff: https://in.mathworks.com/matlabcentral/answers/99625-how-do-i-regenerate-my-matlab-preferences
Let me know if the issue persists after regenerating the said preferences.
Thanks,
Samar
Kategorien
Mehr zu Live Scripts and Functions finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!