필터 지우기
필터 지우기

How to put spaces between the elements inside a char array

조회 수: 5 (최근 30일)
John Rebbner
John Rebbner 2019년 1월 4일
답변: Luna 2019년 1월 4일
Hello, gyus :)
Let's say I have a char array like:
data = [ format_time, ' ', format_data, ' ', '\r\n'];
where
format time = %4d %4d %2d
( There are spaces between the formats)
and
format_data = %6.3f%6.3f%6.3f%6.3f%6.3f%6.3f%6.3f%6.3f
( there are not spaces)
and the output is something like : %4d %4d %2d %6.3f%6.3f%6.3f%6.3f%6.3f%6.3f%6.3f%6.3f
The data from format_data are stored by using xlsread function from excel,
otherwise my outputs are joined
  댓글 수: 2
John Rebbner
John Rebbner 2019년 1월 4일
I forgot to mention that
format_time = ' %4d %4d %2d' - is written manualy
format_data = [format_XT{:}]
where format_XT is an array with the data from excel
Luna
Luna 2019년 1월 4일
편집: Luna 2019년 1월 4일
Could you please specify what is your exact input and what result do you want to get? Do you only want to add spaces to your format_data?

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

채택된 답변

Luna
Luna 2019년 1월 4일
Try this below it might help:
format_data = '%6.3f%6.3f%6.3f%6.3f%6.3f%6.3f%6.3f%6.3f';
format_data = strrep(format_data,'%',' %');
format_data(1) = '';

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Export to MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by