How to get rid of two consecutive double quotes from my string?
조회 수: 5 (최근 30일)
이전 댓글 표시
I have pasted some data from R into one of my Matlab variable. Here, I have a string enclosed with two double quotes e.g ""0110001010001001001011"". Due to these two quotes the length of the string is showing as 1. My objective is to place each bit of the string as an array element. And then convert it into numeric. Directly applying str2num on the exaple gives the result as 1.1000e+20 which does not serve my purpose.
댓글 수: 0
답변 (1개)
Mohammad Sami
2020년 9월 11일
if true
% remove double quotes
somestr = regexprep(somestr,'"','');
Numarray = char(somestr) - '0';
end
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!