How to use "image/imagesc" in Matlab App Designer

3 ビュー (過去 30 日間)
CT-UBC
CT-UBC 2017 年 11 月 28 日
コメント済み: CT-UBC 2017 年 11 月 28 日
Mathworks documentation Matlab 2017b indicates that is capable of supporting the "image" function in uiaxes to handle 2D arrays of numerical data. I am having trouble getting this to work using the current code that I have in App Developer:
This is the output I get using the above code in app designer:
Below is the normal matlab code that I have to produce the desired figure output:
image(AllFrames(:,:,20)) % 2D array of numerical data
axis equal

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 11 月 28 日
You are using functions with static workspaces -- you have an end statement matching the function statement.
Static workspaces cannot have variables "poofed" into them using uiopen('load') or load() without an output or using assignin().
You need to use uigetfile() to get the file to load, and you need to load() and assign that to a variable, and pull the appropriate fields out of the structure that results.
  2 件のコメント
CT-UBC
CT-UBC 2017 年 11 月 28 日
The uiopen('load') works fine because I manually select the workspace to open with the variables that I have precalculated from external code. I know I can access those variables because the PressureFile and ForcesFile strings are extracted properly.
As for the image function problem, I have working now but not with the most elegant solution. There appeared to be some sort of bug in the existing UIAxes created, so when it was deleted and a new UIAXes was created to allocate data to plot/imagesc to, it appears to work now.
CT-UBC
CT-UBC 2017 年 11 月 28 日
In regards to the bug, I believe it has something to do with allowing resizing of components, specifically the UIAxes. Dimensions of the UIAxes were automatically changed in the code after running my data through it. The dimension changes were carried forward and thus prevented future iterations from plotting properly in the UIAXes.

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

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by