MATLAB Answers

Displaying properties defined in MATLAB application

11 views (last 30 days)
Aditya Bhatt
Aditya Bhatt on 25 Jun 2020
Commented: Aditya Bhatt on 10 Jul 2020 at 12:08
How can properties defined in an application be displayed ? The properties have numerical values. I have tried using spinners and EditText Fields but there is an error in the data type.


Aditya Bhatt
Aditya Bhatt on 7 Jul 2020
In that case, what would be a good approach to solve the issue ? Like I said, I have tried running the same logical statements in a MATLAB script and the result appear to be fine. Is there something specific (for eg:- use of 'for loops' ) that needs to be given special attention while creating a Application ?
Walter Roberson
Walter Roberson on 8 Jul 2020
Create two output fields. Set one to be the real part of B, and set the other one to be the imaginary part.
Aditya Bhatt
Aditya Bhatt on 10 Jul 2020 at 12:08
Thanks Walter. I created two output fields and the issue is resolved.

Sign in to comment.

Answers (1)

Adam Danz
Adam Danz on 7 Jul 2020
I just opened app designer and tried to set the value of a spinner to 1.3139 + 0.0069i. I received the same error as you.
'Value' must be a double scalar.
This is a poorly written error because 1.3139 + 0.0069i is a double and is a scalar.
class(1.3139 + 0.0069i)
ans =
isscalar(1.3139 + 0.0069i)
ans =
But it makes sense that the spinner should be a real number.
The solution is to fix the problem with the value of app.B. My guess is that it should not be an imaginary number. Look into how app.B is being computed. If it should be an imaginary number, it's not clear to me how that would be represented in a spinner object.

  1 Comment

Aditya Bhatt
Aditya Bhatt on 10 Jul 2020 at 12:06
Thank you, Adam. I have managed to fix the problem. The value of the variable is still has an imaginary part which should not have been the case. But while assigning the value to the spinner I have used the commal 'real(app.B)' and that has solved the problem. I do intend to analyse the reason as to why the variable is taking up an imaginary value but I feel it will need some time.

Sign in to comment.