Info

此问题已关闭。 请重新打开它进行编辑或回答。

How to separate the values in the cell (see example array)? I need to extract the last column of integers to plot.

1 次查看(过去 30 天)
'CR4 1594669146 -11.745480 -0.429790 -1.62'
'CR4 1594669146 -11.745270 -0.365470 -1.58'
'CR4 1594669147 -11.745270 -0.420530 -1.57'
'CR4 1594669147 -11.745570 -0.496310 -1.64'
'CR4 1594669148 -11.745510 -0.369620 -1.63'
'CR4 1594669148 -11.745150 -0.343360 -1.61'
'CR4 1594669149 -11.745210 -0.363150 -1.58'
'CR4 1594669149 -11.745210 -0.379660 -1.60'
'CR4 1594669150 -11.745480 -0.445020 -1.64'
'CR4 1594669150 -11.745390 -0.465970 -1.66'
'CR4 1594669151 -11.745270 -0.354210 -1.61'
'CR4 1594669151 -11.745480 -0.432570 -1.66'
'CR4 1594669152 -11.745510 -0.318540 -1.61'
I have attemepted to convert it to an array and I am getting errors.
Here is my script:
  2 个评论
Jestoni Orcejola
Jestoni Orcejola 2020-7-18
fileName = 'FloatAscentProfile81kg.txt';
txt = readfile(fileName);
pattern='CR4';
for i=1:length(txt)
TF= contains(txt,pattern, 'IgnoreCase', true);
end
CR4=txt(TF);
CTD=cellstr(CR4);
dlmwrite('CTD.txt',CTD,'delimiter','');
%edit CTD.txt
fid =fopen('CTD.txt');
Pressure_dBar= textscan(fid, '%*s %*s %*s %*s %f %*[^\n]','HeaderLines',1);
fid=fclose(fid);

回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by