Combine three columns with comma for a lot CSV files
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
0 votes
Share a link to this question
Accepted Answer
0 votes
18 Comments
- Load XYZ information from csv files to a Cell structure. The output of this step is a 1× 1000 Cell and each cell records the selected information from each csv.
- For each cell/frame, divide the region of interest (ROI) space (X: -100 m to 100m; Y:-100m to 100m; Z: -5m to 5m) into continuous cubes (0.1m cube length).
- Load XYZ information from csv files to a Cell structure. The output of this step is a 1× 1000 Cell (1000 csv files) and each cell records the selected information from each csv.
- For each cell, divide the region of interest (ROI) space (X: -100 m to 100m; Y:-100m to 100m; Z: -5m to 5m) into continuous cubes (0.1m cube length) .
- The output just store in one column, not a seperated column for every csv.
- The result for first csv is completly correct but for second csv, start with showing first csv and following by second, and for third , show the whole result.
- you converted from an array to a cell array so the repeat count in the format string is that array size, not the size of the data in the cell array total, and
- you're saving the elements of the cell array each pass through the loop so every loop has one more cell containing somthing -- but you write the entire cell array every time by using a{:} (and there's no need for the temporary variable, anyway)
More Answers (1)
0 votes
2 Comments
- Process each file as it is read instead of trying to merge them all at once. Most algorithms are sequential so is at least moderately likely can do so if think through what is that is the end result needed;
- If, indeed, it is mandatory to have all data at one time, use .mat files to save the intermediate and load into what code needs the result.
Categories
Find more on Data Import and Analysis in Help Center and File Exchange
Tags
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)