How to add serial number and some other constant values to my output?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have an output as Text file, which has 9 outputs or 9 columns of data, i want to add serial number or step number for every entry starting from 1 and i want my Torque Field to be '-1' for all the rows and Acquistionrate_HZ to be '10' for all the rows.
Note: number of rows differ every time based on input, PFA output/notepad file
0 Commenti
Risposte (1)
ANKUR KUMAR
il 14 Set 2018
You can simple add a column at the front of your matrix and use dlmcell to write in a text file.
Suppose A is you cell matrix which contains the data which is in your .txt file.
A={'a','b','c','d','e';'f','g','h','i','j';'k','l','m','n','o';'p','q','r','s','t'}
A =
4×5 cell array
'a' 'b' 'c' 'd' 'e'
'f' 'g' 'h' 'i' 'j'
'k' 'l' 'm' 'n' 'o'
'p' 'q' 'r' 's' 't'
A=[arrayfun(@(x) num2str(x) ,[-1,1:size(A,1)-1] ,'uni',0)' A]
A =
4×6 cell array
'-1' 'a' 'b' 'c' 'd' 'e'
'1' 'f' 'g' 'h' 'i' 'j'
'2' 'k' 'l' 'm' 'n' 'o'
'3' 'p' 'q' 'r' 's' 't'
0 Commenti
Vedere anche
Categorie
Scopri di più su LaTeX in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!