Effacer les filtres
Effacer les filtres

How to put spaces between the elements inside a char array

5 vues (au cours des 30 derniers jours)
John Rebbner
John Rebbner le 4 Jan 2019
Réponse apportée : Luna le 4 Jan 2019
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 commentaires
John Rebbner
John Rebbner le 4 Jan 2019
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 le 4 Jan 2019
Modifié(e) : Luna le 4 Jan 2019
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?

Connectez-vous pour commenter.

Réponse acceptée

Luna
Luna le 4 Jan 2019
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) = '';

Plus de réponses (0)

Catégories

En savoir plus sur Data Export to MATLAB dans Help Center et File Exchange

Produits


Version

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by