Clear Filters
Clear Filters

Update content in sliceViewer without creating new sliceviewer object in parent uipanel (appdesigner)

4 views (last 30 days)
Watch out, I might be justing wrong 'object' terminology - sorry!
I'm using appdesigner and an uipanel container where I want to use sliceViewer(). I create my sliceViewer in a function call (from a button press) and plot the data as
sliceViewer(data,'Parent',app.UIPanel)
This creates a sliceViewer object and shows the data as I want it to. However, after changing the data I want to plot new data in the same sliceViewer, so I use the same line again with updated data. It looks to me as this creates an additional sliceViewer object on top of the last one as I can see overlapping slice numbers like '10/100' overlapped with '27/120'. If possible I would like to write new data to the existing sliceViewer object but I don't know how to. I've tried using handles to the sliceViewer as 'Parent' but I'm getting error messages saying sliceViewer only accepts uipanels or uifigures as parents.
Alternetavley, I've tried to access the children of 'app.UIPanel' using 'allchild(app.UIPanel)' or 'findobj(app.UIPanel)' with different variations to be able to delete the existing sliceViewer, but I can't get that to work either. The closest I get is when I try to delete all children (only the sliceViewer object) using 'delete(findobj(app.UIPanel))' which deletes the entire panel. Here I could re-make the panel again, but this seems like a horrible solution.

Accepted Answer

Eric Delgado
Eric Delgado on 23 Oct 2022
Wow @Linus Olofsson... this plot visualization is super weird. It seems impossible to update it! A possible solution is to create your own "sliceViewer". See app attached!
  1 Comment
Linus Olofsson
Linus Olofsson on 23 Oct 2022
That is a bit surprising to hear! I'm already making my own slice viewer equivalent in other parts of the app to be able to use things like imshowpair but that involves manually calculating each slice I want to view, which for my application is a bit of a drag. Maybe I need to stick to making my own, much less user-friendly, slice viewer 😅

Sign in to comment.

More Answers (0)

Categories

Find more on App Building in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!