App Designer: Numerical input to a string

조회 수: 8 (최근 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 CenterFile Exchange에서 Web Services에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by