Spontaneously deleted information from struct variable

5 次查看(过去 30 天)
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 个评论
Cris LaPierre
Cris LaPierre 2023-4-3
编辑:Cris LaPierre 2023-4-3
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 2023-4-3
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.

请先登录,再进行评论。

回答(1 个)

Jack
Jack 2023-4-3
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 个评论
Amit Kallush
Amit Kallush 2023-4-3
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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Graphics Object Programming 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by