Matlab variable viewer does not update structure variables

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 Commenti

@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
No, not the way I am running it. I mean there are other loops, but I am bypassing them. I write code like this
ListofTests={'Test1','Test2','...'};
I=1;
for I=I:length(ListofTests)
TestType=GetTestInfo(ListofTests{I});
switch TestType
case 1
TestStuff=DoThisCode
J=1
for J=J:length(TestStuff)
DoOtherCodeHere
end
case 2
Etc...
end
end
If I am writing code, I will run the first two lines (typically highlighting them and hitting F9).
Then I will skip the for I=I.... line and run the TestType Line. The I will skip the switch case lines and run the TestStuff=DothisCode. I will run them either by testing them on the command line and then copying them into my script, or by writing the script, highlighting it, and hitting F9.
Once the code seems to work (I will step through each loop typically 1 to 2 times), I will run the code and if I get an error, I can repace the I=1 line with wherever it crashed (i.e. I=102) and just rerun the script or step through loop 102. The scripts are for analyzing test data that typically includes 10's or even 100's of thousands of images and other datafiles that are time tagged and need to be correlated. Typically it takes me 1-2 days to write the script while stepping through <<0.1% of the data and then turning the code loose where it analyzes the rest over the course of several hours. Usually overnight.
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.

Accedi per commentare.

Risposte (0)

Categorie

Prodotti

Release

R2025b

Richiesto:

il 3 Mag 2026 alle 22:21

Commentato:

circa 9 ore fa

Community Treasure Hunt

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

Start Hunting!

Translated by