App Designer: Numerical input to a string

7 ビュー (過去 30 日間)
Ryan Browning
Ryan Browning 2017 年 11 月 10 日
回答済み: ES 2017 年 11 月 10 日
I'm making a program where it takes whether you want to receive an email or text message and when i get to the text part i'm confused. You can send texts through email and every network provider has a different domain to send the message to, ex. AT&T is xxxxxxxxxx@txt.att.net and T-Mobile is xxxxxxxxxx@tmomail.net. I have the user do an input for their number and a drop menu for their provider, however when i try to add the number with the correct domain i get an error with the number saying it's not a string evenough i've tried everything to convert the numbers into a string, please help!
app.c1 = string(app.c) %app.c is the domain for the network provider
app.number1 = string(app.textto) %app.textto is the number they input to send the text to
app.c2 = {app.number1, app.c1} %Converting the two strings into one array
app.c3 = string(app.c2) %This is the line that's giving me trouble. It works fine in matlab, only trouble in App Designer
app.c4 = strjoin(app.c3)
app.c5 = erase(app.c4, " ")
app.textto = app.c5
sendmail(app.textto,Subject,message)
Also if someone could tell me how to do drop menu callback correctly so i know. Also the error is: Error using string Conversion from cell failed. Element 2 must be convertible to a string scalar.

採用された回答

ES
ES 2017 年 11 月 10 日
app.c2 is a cell array. You cant use string on cell array.
You can use
app.c2 = [app.number1, app.c1]
app.c3 = string(app.c2)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWeb Services についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by