Displaying properties defined in MATLAB application
Informazioni
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Mostra commenti meno recenti
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.
13 Commenti
Adam Danz
il 25 Giu 2020
There are lots and lots of way to display numeric and text values from an app. Your question isn't specific enought to provide a specific answer.
Could you show us the relevant lines of code that you've tried already? Also include the property values that you're trying to display and any error messages you get.
Aditya Bhatt
il 26 Giu 2020
Adam Danz
il 26 Giu 2020
Any time you reference as error in the forum, you should include the entire error message (all of it). That will tell us what's wrong.
Where is this loop? It looks like some important stuff is missing between the properties defs and the for-loop. The for-loop should be within a function, I believe, and that function should be within the methods sections.
Let's start with the error message.
Aditya Bhatt
il 26 Giu 2020
Walter Roberson
il 26 Giu 2020
I suggest putting in a couple of lines that display size() and type() of app.B before attempting the assignment to app.BSpinner.Value in order to debug the problem.
Aditya Bhatt
il 29 Giu 2020
Adam Danz
il 29 Giu 2020
According to the error, App.B is either not double, not a scalar, or it's neither. Could you add this line and show us the output?
disp(app.B) % <--- add this line
app.BSpinner.Value = app.B;
Walter Roberson
il 30 Giu 2020
I would suggest using dbstop if error
I am wondering if the error really is on that line, or if it is on the line before, the plot() call.
Aditya Bhatt
il 4 Lug 2020
Adam Danz
il 6 Lug 2020
The warning and the error are generated at different lines in the code. I'm not convinced that they are releated based on the error and warning messages.
Furthermore, the imaginary number is a double and is a scalar.
x = 1.3139 + 0.0069i;
class(x)
ans =
'double'
isscalar(x)
ans =
logical
1
Aditya Bhatt
il 7 Lug 2020
Walter Roberson
il 8 Lug 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
il 10 Lug 2020
Risposte (1)
Adam Danz
il 7 Lug 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 =
'double'
isscalar(1.3139 + 0.0069i)
ans =
logical
1
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 Commento
Aditya Bhatt
il 10 Lug 2020
Questa domanda è chiusa.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


