0

How can i convert a string to a number? number_of_plots = '4' but i want 4 without ''

Tabel_Cell = table2cell(diagramoptions) ;
idx= strfind(Tabel_Cell(:,1), 'number_of_plots');
idx = find(not(cellfun('isempty',idx)));
number_of_plots = Tabel_Cell{idx,2}
%number_of_plots1=double(number_of_plots);
%number_of_plots1=str2num(number_of_plots);
0

1 Answer 1

2

You can use str2num to convert strings to numbers.

If you want to convert them into floats rather use str2double which is faster (and safer) than str2num

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

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.