mardi 14 avril 2015

Preserve blank space while using cellstr


Vote count:

0




I'm trying to store a series of formated numbers as a strings in a table and I need to preserve all the white spaces. I don't know if there's a better way to store strings in a table (any recommendation would be appriciated) but this is what I'm using.



% Initialize table
mytable = array2table(cell(5,5));

% Variables
a = 0.04;


I want to store '0.04 ' (with 2 blank spaces at the end) in the first cell of mytable. This is what I tried:



mytable{1,1} = cellstr([num2str(a), ' ']);


However, I know that cellstr() doesn't preserve white spaces. I don't know what function to use to store the variables. I tried with char() but I'm getting errors. Thank you!



asked 25 secs ago

mat

92






Preserve blank space while using cellstr

Aucun commentaire:

Enregistrer un commentaire