File Exchange

image thumbnail

CSV with Headers Import/Export

version 1.0.1 (2.16 KB) by theblueeyeswhitedragon
Performs conversions csv to mat, and mat to csv. Works for csv files with and without header information.

4 Downloads

Updated 10 Aug 2018

View Version History

View License

The main function takes no parameters and prompts the user to select the type of csv file operation to be performed.

ImportCSV - Prompts the user to select a csv file in current folder. It imports its header and data information and saves it in a .mat file

ExportCSV - Prompts the user to select a .mat file in current folder. It uses the header and data inputs to create a csv file in your current folder

Cite As

theblueeyeswhitedragon (2020). CSV with Headers Import/Export (https://www.mathworks.com/matlabcentral/fileexchange/68459-csv-with-headers-import-export), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

xd caleb

Export .mat to .csv.but the .csv's dont have data

Stephen Cobeldick

"Prompts the user to select a csv file in current workspace"

"Prompts the user to select a .mat file in current workspace"

These statements do not make sense. The MATLAB workspace does not store any files. The MATLAB workspace can contain MATLAB variables, which are arrays (e.g. numeric arrays, character arrays, cell arrays, struct arrays, etc), or handles to various objects (e.g. graphics objects), and several other kinds of object. These concepts are explained in the MATLAB documentation:

<https://www.mathworks.com/help/matlab/workspace.html>

<https://www.mathworks.com/help/matlab/matlab_prog/base-and-function-workspaces.html>

What this submission actually does is import file data from the Current Folder. The Current Folder is simply a folder which has priority on the MATLAB Search Path:

<https://www.mathworks.com/help/matlab/matlab_env/current-folder-browser-preferences.html>

<https://www.mathworks.com/help/matlab/matlab_env/what-is-the-matlab-search-path.html>

This submission imports data from files in the current folder and saves it again with a different file format.

If the author had returned the second output from UIGETFILE then it would not be restricted to only files in the the Current Folder.

MATLAB Release Compatibility
Created with R2017b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!