STRING ARRAY TO NUMERIC VALUES ( I want to change the array's type to plot the graph, even though I use double function or str2num that doesn't change anything and it still string)
조회 수: 3 (최근 30일)
이전 댓글 표시
![Capture.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/214873/Capture.png)
댓글 수: 0
채택된 답변
추가 답변 (1개)
Walter Roberson
2019년 4월 19일
new_frequency(1:rowRPM(1,1)) = str2double(frequency(1:rowRPM(1,1)));
In the special case where you are converting all of the entries, then you can use
frequency = str2double(frequency);
but if rowRPM(1,1) is not equal to the number of elements in frequency, then you need to write to a new location.
In particular, you cannot work the way you are doing now, converting an entry and writing it back to the same array. The string() class will detect that you are storing a number in a string location, and will helpfully format the number as a string and store the string.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!