How to use a 4d variable achieved from a function as a property in matlab app designer?

1 view (last 30 days)
I have a function which takes few inputs and then returns some values which contain 3 variables x,y,z (all are 3d arrays) and a variable N1 which is a 4d array. I am trying to plot N1 using slice but I am getting error as there seems to be some problem when I am trying to use N1 as a property. Please help me out.
here I have tried to define Lz, yz, and zz (3d coordinates) and N1 as property. Can anyone suggest what might be the problem?

Answers (2)

Kanishk
Kanishk on 13 Aug 2024
Hi Ron,
I understand from the question you are using the slice function defined in MATLAB to extract a slice of the volume for plotting.
According to the official MATLAB documentation of the slice function and your use case, the function will take the following arguments:
  • x, y, z: Coordinate Data
  • V: Volumetric Data
  • xslice, yslice, zslice
The usage of the slice function in the code you provided is:
slice(app.Top, app.Lz , app.yz, app.zz, sum(app.N1, 4), xslice, yslice, zslice)
This does not match the documentation and is causing an error. Removing the ‘app.Top’ argument should fix the error, as it seems to be an extra argument for the function. However, since the function ‘sphere_vol’ is not available, I am unable to test this.
To learn more about the ‘slice’ please go through the following documentation:
Hope this helps!
Thanks,
Kanishk

Walter Roberson
Walter Roberson on 13 Aug 2024
slice() is not able to slice 4D data.
You are taking sum(app.N1,4) to reduce the data to 3D, but you are still attempting to list 4 different input coordinates

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!