App Designer: Numerical input to a string

9 visualizaciones (últimos 30 días)
Ryan Browning
Ryan Browning el 10 de Nov. de 2017
Respondida: ES el 10 de Nov. de 2017
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.

Respuesta aceptada

ES
ES el 10 de Nov. de 2017
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)

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by