AppDesigner UIListBox Multi-Select Corrupts .MLAPP File

2 ビュー (過去 30 日間)
Greg
Greg 2017 年 1 月 23 日
コメント済み: Pierre Puchaud 2019 年 12 月 18 日
I'm mostly posting this more than asking a question just so other people don't lose days/weeks of work like I did.
If you add the uilistbox control in AppDesigner, then make it multi-select, there doesn't appear to be a way to make a default multiple selection. However, if you switch to code view, you can manually edit the uilistbox "Value" property and type in as many selections as you like. Everything looks great at this point, and it even has the correct selection value at startup.
Here's the bug: after startup, the uilistbox has no visible selection, and cannot be multi-selected. Here's the potentially serious: if you close AppDesigner at this point, your .MLAPP file becomes quite corrupt, and I haven't found a way to get it back.
The obvious workaround is to programmatically set the default selection in the startupFcn, rather than in the object properties.
To make it a question so I don't get flamed: Does anybody know a way to "hack" the corrupt .MLAPP file back to an AppDesigner-editable state?
  3 件のコメント
Greg
Greg 2018 年 6 月 26 日
I never looked into it. It appears that R2018a (possibly earlier releases) won't corrupt the .MLAPP file in this manner anymore.
Any chance you can share your corrupted file?
Christopher
Christopher 2018 年 6 月 26 日
Unfortunately I cannot share the document. But I will go for the R2017b solution and try to fix it by loading the file there. Thank you for your help.

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

回答 (2 件)

Greg
Greg 2018 年 6 月 26 日
It isn't the best, but I found out the "corrupted" .MLAPP files will open in newer releases just fine. This doesn't help if you can't install, and leaves you with a "potentially incompatible" file.
However, it does give you at least an opportunity to look at (and maybe copy/paste) everything that was done leading up to the listbox.
Here's what I did:
  1. Create a corrupted .MLAPP file in R2016b
  2. Open it in R2017b
  3. Undo the multi-selection in code view property inspector (in R2017b)
  4. Save the file (with a new name if you want, but your file is already corrupt...)
  5. Open the new file in R2016b and re-save (again, new name if you want). At this point you'll get some cookie-cutter warning about incompatibility, but at least you can work in design and code view.

Greg
Greg 2018 年 6 月 26 日
A second approach that somebody out there might have more luck with is to hack the .MLAPP file directly. I know it's just a .ZIP file (like .DOCX and others), and most of the differences between working and corrupt files come from the appdesigner\[somefilename].mat file.
However, the differences are spaghetti-coded all through the file, and some of them are private class properties you can't easily edit. If I figure it out, I'll update the answer.
  1 件のコメント
Pierre Puchaud
Pierre Puchaud 2019 年 12 月 18 日
Any clue ?
I have corrupted .mlapp file from 2018a version that i cannot open on 2019b.

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

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by