how can ı group while table writing in excel
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
this code:
allKeys = arrayfun(@char, h.keySet.toArray, 'UniformOutput', false);
allValues = cellfun(@(x) h.get(x), allKeys, 'UniformOutput', false);
for f=1:size(allKeys)
for p=1:size(allValues)
T = table(unique(allKeys(f)),allValues(p), 'VariableNames', {'name1', 'name2'})
writetable(T,'xxx.xlsx','WriteMode', 'append')
end
end
excel file:

I want to while write excel:

0 commentaires
Réponses (1)
Walter Roberson
le 7 Juin 2021
MATLAB does not support writing multiple numeric values to the same excel cell. You would have to use character or string entries.
Your file appears to mix using decimal point as the decimal separator, with using comma as the decimal separator.
4 commentaires
Walter Roberson
le 7 Juin 2021
Your input Excel file shows 7,67279195 in column 2 of rows 1, 5, 9, and 13.
Your desired output file shows 7,67279195 in column 2 of row 1, but shows 7,672791953 (with extra "3") in column 4 of row 1.
Your input Excel file shows 9,50861283 in column 2 of rows 2, 6, 10, and 14.
Your desired output file shows 9,50861283 in column 2 of row 2, but shows 9,508612828 in column 4 of row 2.
Where did the extra "3" come from for row 1, 7,67279195 compared to 7,672791953 ?
How did the 9,50861283 change to 9,508612828 between columns 2 and 4 of row 2?
It is not difficult for us to provide code that just moves data around, but you are not just moving data around: you are doing some kind of calculation on the data that interpolates the data to one more decimal place than it has on input, and we need to understand how that extra digit is calculated in order to be able to write code to do the calculation.
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!