I have data in excel column of format BANKNIFTY03JUN2127800PE.NFO which i want to split at fixed width like - Column 1 : BANKNIFTY, COlumn 2 with date : 03JUN21, COlumn 3 with strike price: 27,800, column 4: PE COlumn5:.NFO. How do i do it ?

댓글 수: 2

@sushil malani: please click the paperclip button and upload an original data file.
column 1 is what i want to be split.

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

 채택된 답변

Walter Roberson
Walter Roberson 2023년 4월 20일
filename = 'AppropriateFileName.xlsx';
AppropriateColumnNumber = 7; %change to actual column number
opts = detectImportOptions(filename);
opts = setvartype(opts, AppropriateColumnNumber, 'string');
T = readtable(filename, opts);
TC = T{:,AppropriateColumnNumber};
%comment out any entries you do not need the output for
BANKNIFTY = extractBetween(TC, 1, 9);
date = datetime(extractBetween(TC, 10, 16), 'InputFormat', 'ddMMyy');
strike_price = double(extractBetween(TC, 17, 21));
PE = extractBetween(TC, 22, 23);
NFO = extractBetween(TC, 24, 27);

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

제품

릴리스

R2023a

태그

질문:

2023년 4월 20일

댓글:

2023년 4월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by