'Matrix dimensions must agree' error in matlab app designer

2 ビュー (過去 30 日間)
ErikJon Pérez Mardaras
ErikJon Pérez Mardaras 2021 年 2 月 23 日
I am doing the following app.
There is a drop menu (called app.menu) in which the user selects one of the options there, then, he clicks on the button and a certain value appears on the box (called app.caja), as you can see in the code below.
Here is the code in the button callback:
function botonButtonPushed(app, event)
if app.menu.Value=='engranaje'
app.caja.Value=1
elseif app.menu.Value=='ruedaa0'
app.caja.Value=2
elseif app.menu.Value=='ruedaav'
app.caja.Value=3
end
end
The issue is that it works perfectly when the options in the dropmenu are "short" words as "a" or "b" with one or two letters, but when the are full words (like the case here) it doesn't work and appears the following error:
Matrix dimensions must agree
How can I solve this? Thank a lot
  2 件のコメント
Cris LaPierre
Cris LaPierre 2021 年 2 月 23 日
Please share the full error message (all the red text).
ErikJon Pérez Mardaras
ErikJon Pérez Mardaras 2021 年 2 月 23 日
編集済み: ErikJon Pérez Mardaras 2021 年 2 月 23 日
Here they are both, the error message in the code and in the command window

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

採用された回答

Walter Roberson
Walter Roberson 2021 年 2 月 23 日
function botonButtonPushed(app, event)
if app.menu.Value=="engranaje"
app.caja.Value=1
elseif app.menu.Value=="ruedaa0"
app.caja.Value=2
elseif app.menu.Value=="ruedaav"
app.caja.Value=3
end
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by