0

I'm working with GUIDE on MATLAB. In my GUI, there is a text field in which the user is to enter an array of numbers. How can I convert this into a form that can be used to perform calculations? Basically my question is how can a string like "[1 1 1]" be converted into an array? (I'm working with integers from the range of 0-360 so string-'0' doesn't work for me.)

1 Answer 1

1

You can use this:

 a = str2num('[1 1 1]')

Not sure what you meen by "string-'0' doesn't work for me" though.

Sign up to request clarification or add additional context in comments.

1 Comment

This works for me, thanks for your help! What I meant was when I execute b='[90 90 90]'-'0' for example I get 9 0 9 0 9 0 as an output. I needed something to keep it as 90.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.