The example doesn't work as is, exactly...
>> res = ['Carreau-Parameter: ';'a = 7521.1446 Pa*s ';'b = 0.10637 s ';'c = 0.78114 '];
Error using vertcat
Dimensions of arrays being concatenated are not consistent.
>>
Think you'll get along a lot better if you would use cellstr instead of char() array --
>> res=strtrim([{'Carreau-Parameter: '};{'a = 7521.1446 Pa*s '};{'b = 0.10637 s '};{'c = 0.78114 '}]);
>> cellfun(@strsplit,res,'UniformOutput',false)
ans =
4×1 cell array
{1×2 cell}
{1×5 cell}
{1×5 cell}
{1×4 cell}
>> ans{:}
ans =
1×2 cell array
{'Carreau-Parameter:'} {0×0 char}
ans =
1×5 cell array
{'a'} {'='} {'7521.1446'} {'Pa*s'} {0×0 char}
ans =
1×5 cell array
{'b'} {'='} {'0.10637'} {'s'} {0×0 char}
ans =
1×4 cell array
{'c'} {'='} {'0.78114'} {0×0 char}
>>
Looks to produce what you asked for. You could eliminate the trailing null char artifact from strsplit.
To put into a regular, rectangular cell array would require augmenting shorter rows to length of the maximum.
Alternatively, if there aren't too many, you could just loop over the array to wrtie altho that will be inefficient.
Best Answer