Spontaneously deleted information from struct variable

6 views (last 30 days)
Hi,
I have a wierd problam. I'm using Matlab 2023a, but it also happens in 2022 a&b, so I don't think it's related to the software version.
The thing is, I have a complex structure, which has 4 fields. The first field is a cell, but all the others are also structures so that a typical value can look like this:
Par.P(1).X = 721041
The thing is that while the variable is open on the variable window (so you can see the structure table with all the data), and one of the table cells is selected, sometimes Matlab decides spontaneously to delete the content of this cell. It is followed by the following statement in the Command window (for example):
Par.P(1).FR = [];
As far as I can tell, it only happens in these complex structures, not in any other types of variables or simple structures.
Has anyone know what might be the cause of this annoying problem?
Thanks!
Amit
  6 Comments
Cris LaPierre
Cris LaPierre on 3 Apr 2023
Edited: Cris LaPierre on 3 Apr 2023
When it happens, are there other variables in your workspace? Are you toggling back and forth between a script and the variable editor? Are there any actions you are performing that could be contributing? Has your session been running for a long time? Have you just finished running a script?
Just curious what state your MATLAB is in when this happens.
Amit Kallush
Amit Kallush on 3 Apr 2023
Hi, iv'e managed to get two screenshots of this happens, but first of all to answer your questions.
Yes there are other variabels, but they are not affected by it, actually it never happend to me on any variable that is not struct. this time, I opend the variable and left the computer for 2 minuets without thuching it, and suddenly I saw this. you can see that the top-left cell is empty, but there should be a number there.
After that, if I click anywhere the line ">> Par.P(1).ID = [];" appear and the content of the cell become "[]":
As for your other questions, the session is open for about 10 hours I guess, but I finished running the last script about 3 hours ago, and havent done anything since then accept for open the variable just now.

Sign in to comment.

Answers (1)

Jack
Jack on 3 Apr 2023
This sounds like a very strange issue that could potentially be caused by a bug in MATLAB. Here are a few suggestions that you could try to help troubleshoot and potentially solve the issue:
  1. Check if the issue persists in a new MATLAB session: Close MATLAB and reopen it to see if the issue still occurs. If the issue goes away in a new session, it could be a temporary problem that might have been caused by a specific operation or interaction with MATLAB.
  2. Check for any scripts or functions that might modify the structure: It's possible that there is a script or function that modifies the structure and could be inadvertently deleting the content of the cell. Search your codebase for any functions that modify the structure and see if any of them could be causing the issue.
  3. Check for any unintentional key presses: Sometimes, unintentional key presses can occur while typing or using the mouse. This could potentially cause the content of the cell to be deleted. Try to be mindful of any key presses that might occur while using MATLAB.
  4. Report the issue to MathWorks: If none of the above solutions work, you could consider reporting the issue to MathWorks support. They might be able to provide more insight into the issue or help you find a solution.
I hope one of these suggestions helps you solve the issue.
  1 Comment
Amit Kallush
Amit Kallush on 3 Apr 2023
Thanks for the Answer!
I will try to answer your questions:
  1. It is an issue I've been dealing with for over six months, so definitely not a problem of a specific session.
  2. I don't think that this is the problem. No code is running during the phenomena, and nothing should delete data.
  3. Again, as this problem occurs over a long period of time, I don't think it's a matter of a pressed key. Also, I can't always reproduce it, it just happens randomly.
  4. I will try to report it! thank you for your help
Amit

Sign in to comment.

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!