필터 지우기
필터 지우기

Extracting data to plot time series with different colour for different days

조회 수: 2 (최근 30일)
I want to plot a time series plot of pressure data for different days, like the one I have attached below.
I am using the following files to read the data. In the dataset, before LTST, there is the sol no also attached, which I am not able to extract. I am not being able to extract both seperately. I was able to extract LMST and sol using extractAfter and extractBefore functions as there is a 'M' seperating them. Any suggestions on how to extract LTST and sol?
  댓글 수: 2
Anirban Mandal
Anirban Mandal 2023년 5월 25일
I did that already. I used readtable to extract the column and used table2array to convert it. Then I used strfind to find the space between them and seperate them. But, it was giving me error. I am attaching the code. The problem is that table2arrray is converting it to a cell array and that's why the last two lines are giving me errors.
clear
clc
x=readtable('WE__0567___________CAL_PS__________________P01.csv');
timeinfo=table2array(x(:,3));
spaceidx=strfind(timeinfo, ' ');
sol=timeinfo(1:spaceidx-1);
ltst=timeinfo(spaceidx+1:end);

댓글을 달려면 로그인하십시오.

채택된 답변

Saffan
Saffan 2023년 6월 2일
Hi Anirban,
You can use the “split” function to extract “sol” values from LTST column using space as a delimiter.
Here is a code snippet to demonstrate that:
x = readtable('WE__0569___________CAL_PS__________________P01.csv');
timeinfo = table2array(x(:,3));
% Split timeinfo into SOL and LTST columns
splitCol = split(timeinfo, " ");
ltst = splitCol(:,2);
sol = str2double(splitCol(:,1));
Refer to this link for more information on splitting strings using delimiters:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Title에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by