how I can remove head of file
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have the following code:
fid = fopen('h.csv', 'rt');
for i = 1 : 4 : size( h,1 )
disp( h( i : i + 3,: ) )
disp(['[*,*,' num2str((i + 3)/4) ']: 1 2 3 4 5 6 7 8 9 10:='])
end
The out put is :
VarName1 VarName2 VarName3 VarName4 VarName5 VarName6 VarName7 VarName8 VarName9 VarName10 VarName11
________ ________ ________ ________ ________ ________ ________ ________ ________ _________ _________
51.6 -150.72 -2.0019 103.65 -70.626 -22.092 66.056 -40.393 0.16829 10.898 ""
106.4 -295.17 -64.931 324.57 -238.19 -82.353 345.96 -384.93 255.54 -100.14 ""
107.6 -289.44 -88.518 357.14 -262.29 -72.936 341.1 -378.48 244.79 -93.139 ""
112.5 -294.12 -115.59 405.77 -297.5 -71.468 371.77 -416.44 271.83 -104 ""
[*,*,74]: 1 2 3 4 5 6 7 8 9 10:=
VarName1 VarName2 VarName3 VarName4 VarName5 VarName6 VarName7 VarName8 VarName9 VarName10 VarName11
________ ________ ________ ________ ________ ________ ________ ________ ________ _________ _________
50.9 -148.24 -2.0019 100.41 -67.933 -16.936 47.722 -11.042 -30.068 30.077 ""
118.6 -315.43 -103.4 391.24 -278.28 -80.563 345.19 -351.99 200.75 -59.592 ""
120.2 -324.12 -94.002 385.69 -274.01 -92.952 370.64 -388.75 231.94 -76.445 ""
107.1 -276.4 -117.42 390.35 -276.5 -83.964 368.85 -400.59 251.91 -90.159 ""
[*,*,75]: 1 2 3 4 5 6 7 8 9 10:=
VarName1 VarName2 VarName3 VarName4 VarName5 VarName6 VarName7 VarName8 VarName9 VarName10 VarName11
________ ________ ________ ________ ________ ________ ________ ________ ________ _________ _________
what I should do do remove variables's name and this horizontal line?
0 commentaires
Réponses (1)
Shubham
le 8 Oct 2024
Hey Sherek,
I believe that you have not provided the complete code snippet as the variable 'h' is not defined. Since your dataset appears to be having only numerical values, I recommend you to use the readmatrix function:
fid = fopen('h.csv', 'rt');
h = readmatrix('h.csv');
disp( h( 1 : 4,: ) );
On the contrary, if you need to display the headers, I would suggest you to use the readtable function:
T = readtable("h.csv");
disp(T(1:2,:));
fclose(fid);
I hope this helps!
0 commentaires
Voir également
Catégories
En savoir plus sur Whos 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!