Why does Simulink delete code from matlab functions body?

As described, Simulink sometimes randomly deletes the body code from matlab function blocks. Any attempt to bring back the deleted code is useless. Does anyone have the same issue?
(Matlab 2021 B release running)

9 件のコメント

Sivani Pentapati
Sivani Pentapati 2022 年 1 月 5 日
Could you please provide the Simulink model file with which you are facing the trouble so that we can replicate the issue at our end.
Alessandro Minerba
Alessandro Minerba 2022 年 1 月 5 日
編集済み: Alessandro Minerba 2022 年 1 月 5 日
There's no specific simulink model file were the issue persists. It can happen in every model since the 2021b update, even in old version files. However i can provide a casual simulink model if needed
Sivani Pentapati
Sivani Pentapati 2022 年 1 月 5 日
I have tried with few examples and did not observe the issue. Could you provide the Simulink Model with which you are facing the issue you are referring to?
Alessandro Minerba
Alessandro Minerba 2022 年 1 月 5 日
Here's a model. The issue appeared several times in the accel_meas bock. Cannot load the dataset because it's too heavy
Sivani Pentapati
Sivani Pentapati 2022 年 1 月 7 日
As the model cannote be simulated without the dataset, it would be difficult to interpret the issue. Could you please share actual code for the function and the new code of the function from which the body code is removed?
Alessandro Minerba
Alessandro Minerba 2022 年 1 月 7 日
I'm sorry but I don't understand what do you need.. the problem is that sometimes, in every kind of simulink model, MATLAB deletes the body function of the MATLAB function simulink block. There's no specific code, nor specific simulink model, confirmed by the fact that another user reported the same problem by commenting this issue.
Alessandro Minerba
Alessandro Minerba 2022 年 1 月 7 日
I recovered a subset of data for the model uploaded before. You can run the load_data.m and then the simulink model. Hope it could help
Ben MacCallum
Ben MacCallum 2022 年 1 月 17 日
編集済み: Ben MacCallum 2022 年 1 月 17 日
I have experienced this problem time and time again since upgrading to 2021b. I have lost the code within several different MATLAB Function blocks after saving and reopening the model. This is not specific to one model and it only happens occasionally, but after the code is lost, it never reappears, no matter how many times the model is closed and reopened. I would like to know if there is a way to recover the lost code.
Alessandro Minerba
Alessandro Minerba 2022 年 2 月 11 日
No way to recover the lost code. Just rewrite it or try to close the model without saving any update.

サインインしてコメントする。

回答 (2 件)

Andrea Mazzeo
Andrea Mazzeo 2021 年 12 月 28 日

2 投票

Same issue here. Seems to be common since my colleagues have encountered it too on multiple occasions.
Sivani Pentapati
Sivani Pentapati 2022 年 1 月 18 日
編集済み: Sivani Pentapati 2022 年 6 月 26 日

2 投票

Hi Alessandro,
The Development team is aware of this issue and has published a Bug Report Bug Reports (mathworks.com). Please visit the Bug Report to get the latest information on fixes and possible workarounds.

8 件のコメント

Ted Ecclestone
Ted Ecclestone 2022 年 1 月 22 日
編集済み: Ted Ecclestone 2022 年 1 月 22 日
I upgraded to MATLAB R2021b Update 2 a few days ago, but even so, I have just experienced the same issue that Alessandro described. I also experienced this issue (using R2021b) before upgrading, as others have mentioned.
Ben MacCallum
Ben MacCallum 2022 年 1 月 31 日
Following an update to R2021b Update 2, this issue is still persisting.
Alessandro Minerba
Alessandro Minerba 2022 年 2 月 11 日
I've updated Matlab to R2021b Update 2 but the issue has just happened. This is really disheartening..
Sivani Pentapati
Sivani Pentapati 2022 年 3 月 2 日
Hi Alessandro,
Thank you for bringing this issue to our notice. This issue is now resolved in MATLAB R2021b Update3. We have updated Bug Report of R2021b with this issue. Please refer to the below link for the workaround along with the bug report.
Sanjeet Kulkarni
Sanjeet Kulkarni 2022 年 5 月 26 日
Hi Sivani,
I using MATLAB 2022a and still facing that issue. No way to recover the code in the function file. I have to rewrite it now!
Naeimeh N
Naeimeh N 2022 年 5 月 26 日
Hi Sivani,
I'm using MATLAB 2021b Update 3. The problem persists. I save my model after each change, but the model either does not hold the code or deletes it.
Sivani Pentapati
Sivani Pentapati 2022 年 5 月 31 日
Thank you for providing the information, I have brought this issue to the notice of the concerned people and I will get back to you.
Dr. Fernando Viadero-Monasterio
Dr. Fernando Viadero-Monasterio 2022 年 10 月 19 日
Thank you for your help, I will update Matlab and see if it happens again. In my case, this problem only shows up when I am calling Simuling externally from the vehicle simulation software CarSim

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeSimulink Environment Customization についてさらに検索

製品

リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by