0

The program asks for input in gui editbox as a value, then it takes this value and applies the equation to get the pressure. I haven't been able to do so and I heard from some classmates that matlab takes the input as a string and doesn't operate strings.

get(handles.spl,'String') this is how I get the value, I tried get(handles.spl,'Double') instead but it didn't work, also tried str2double.

I don't know what else to try, I'm also pretty new in programming. I'd appreciate the help, thanks.

Kayathiri
  • 779
  • 1
  • 15
  • 26

1 Answers1

0

You are correct that the uicontrol String property returns...a string. So you'll need to convert it to a number using str2double.

u = uicontrol('style', 'edit', 'String', '42');

strvalue = get(u, 'String');
numvalue = str2double(strvalue);
%   42
Suever
  • 64,497
  • 14
  • 82
  • 101