フィルターのクリア

How to get rid of two consecutive double quotes from my string?

4 ビュー (過去 30 日間)
Surama Biswas
Surama Biswas 2020 年 9 月 11 日
コメント済み: Surama Biswas 2020 年 9 月 11 日
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.

回答 (1 件)

Mohammad Sami
Mohammad Sami 2020 年 9 月 11 日
if true
% remove double quotes
somestr = regexprep(somestr,'"','');
Numarray = char(somestr) - '0';
end
  1 件のコメント
Surama Biswas
Surama Biswas 2020 年 9 月 11 日
Deletion of double quotes does not solve the original problem. I delted double quotes using
newStr = strip(str, 'both', '"');
But still the length of newStr is 1 and I can't seperate individual bits out of that. Please help me place each bit as an array element.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by