matlab - Preserve blank space while using cellstr -


i'm trying store series of formated numbers strings in table , need preserve white spaces. don't know if there's better way store strings in table (any recommendation appriciated) i'm using.

% initialize table mytable = array2table(cell(5,5));  % variables = 0.04; 

i want store '0.04 ' (with 2 blank spaces @ end) in first cell of mytable. tried:

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

however, know cellstr() doesn't preserve white spaces. don't know function use store variables. tried char() i'm getting errors. thank you!

you might want try strcat:

mytable{1,1} = strcat(num2str(a),{'  '}) 

which gives output:

mytable =         var1      var2    var3    var4    var5     ________    ____    ____    ____    ____      '0.04  '    []      []      []      []       []          []      []      []      []       []          []      []      []      []       []          []      []      []      []       []          []      []      []      []   

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -