How to do +,-,*,/ with one scalar and one matrix(IN GUI)?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1048975/image.png)
0 Commenti
Risposte (2)
Walter Roberson
il 28 Giu 2022
str2double always returns a scalar when the input is a character vector or character array. It only returns a matrix if the input is a string array or a cell array of character vectors.
We cannot tell what handles.matrica refers to. If it refers to a uicontrol style 'edit' then if you set the 'Maximum' property to more than 1, then the String property could be a cell array of character vectors that is a column vector, in which case each row would have its character vector processed, returning one scalar per row.
If you have multiple entries in the same row of a uicontrol 'edit' then str2double is going to return nan for the row.
If you want the user to enter a 2d array of numbers, use a uitable()
0 Commenti
Benjamin Thompson
il 28 Giu 2022
Addition and subtraction are the same. You can add or subtract a scalar from a matrix. Adding or subtracting matrices requires they have the same size.
If you are trying to multiple matrices (of same size) as a series of scalar multiplications instead of traditional matrix multiplication, use the .* operator. Use ./ for division, and .^ to raise all the elements of a matrix by a scalar exponent.
You can multiple or divide a matrix by a scalar using *, /, or .* or ./.
0 Commenti
Vedere anche
Categorie
Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!