how to do Shifting of text

조회 수: 5 (최근 30일)
ANAND VISHAL
ANAND VISHAL 2020년 2월 27일
댓글: Stephan 2020년 2월 28일
Assume this is text line:
volatile uint8_T AtomcMduleCnt_Z_Pt = 7U;/* Atomic Module Count in Pack */
I have to shift this line by 4 position:
volatile uint8_T @ AtomcMduleCnt_Z_Pt = 7U;/* Atomic Module Count in Pack */
so how to do shifting of text in matlab?

답변 (1개)

Stephan
Stephan 2020년 2월 27일
편집: Stephan 2020년 2월 27일
A = "volatile uint8_T AtomcMduleCnt_Z_Pt = 7U;/* Atomic Module Count in Pack */"
B = insertAfter(A,"uint8_T"," @")
A =
"volatile uint8_T AtomcMduleCnt_Z_Pt = 7U;/* Atomic Module Count in Pack */"
B =
"volatile uint8_T @ AtomcMduleCnt_Z_Pt = 7U;/* Atomic Module Count in Pack */"
  댓글 수: 4
ANAND VISHAL
ANAND VISHAL 2020년 2월 27일
편집: ANAND VISHAL 2020년 2월 28일
Sir this is text file and we cannot alter the text file.
This is the input file and output file we have to write m script in such a way without alter input we get output file.
Stephan
Stephan 2020년 2월 28일
A = fileread('Input_file.txt');
B = replace(A, ["uint8_T " "real32_T " "real32_B "],["uint8_T Rom_" "real32_T Rom_" "real32_B Rom_"]);
fileID = fopen('Output_File.txt','w');
fprintf(fileID, B);
fclose(fileID);

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

카테고리

Help CenterFile Exchange에서 Electrical Block Libraries에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by