Rank: 425 based on 297 downloads (last 30 days) and 1 file submitted
photo

Ashish Sadanandan

E-mail
Lat/Long
40.054752, -105.20628

Personal Profile:
Professional Interests:
Simulink, RTW

 

Watch this Author's files

 

Files Posted by Ashish
Updated   File Tags Downloads
(last 30 days)
Comments Rating
18 Aug 2011 CSVIMPORT CSVIMPORT reads the specified CSV file and stores the contents in a cell array or matrix. Author: Ashish Sadanandan csv, csvread, read csv 297 23
  • 5.0
5.0 | 12 ratings
Comments and Ratings by Ashish View all
Updated File Comments Rating
25 May 2012 CSVIMPORT CSVIMPORT reads the specified CSV file and stores the contents in a cell array or matrix. Author: Ashish Sadanandan

Hi Sayanta,
Call the function as follows:

[C1 C2 C3 C4 C5] = csvimport( 'path\to\file.csv', 'columns', [1:5], 'noHeader', true, 'delimiter', ';' )

28 Oct 2009 CSVIMPORT CSVIMPORT reads the specified CSV file and stores the contents in a cell array or matrix. Author: Ashish Sadanandan

Maney,
Try running 'which -all isscalar' at the command line, if MATLAB doesn't find any function by that name then you're either using an old version which doesn't have this function or you have problems with the MATLAB search path. Let's assume it's the former since you'd probably be having other errors too if the cause were to be the latter.

ISSCALAR simply checks whether the operand is a 1x1 matrix. You can replace isscalar(x) with (numel(x) == 1) OR (prod(size(x)) == 1)

HTH,
Ashish

27 Aug 2009 GridBagLayout A MATLAB class which controls layout and resize of a figure/uipanel/uicontainer. Author: Jason

Comments and Ratings on Ashish's Files View all
Updated File Comment by Comments Rating
18 Mar 2014 CSVIMPORT CSVIMPORT reads the specified CSV file and stores the contents in a cell array or matrix. Author: Ashish Sadanandan jason

Pretty cool function. However, It would be nice if it called the imported date by the orginal file name and not 'ans'

24 Oct 2013 CSVIMPORT CSVIMPORT reads the specified CSV file and stores the contents in a cell array or matrix. Author: Ashish Sadanandan DBS

03 Oct 2013 CSVIMPORT CSVIMPORT reads the specified CSV file and stores the contents in a cell array or matrix. Author: Ashish Sadanandan Greg

Added support for commas that are in between double quotes. so that they stay in one cell. First it replaces commas than are not in between quotes to semicolons, then splits by semicolons. Then removes the quotes. Starts at line 246 (the main for loop)

rowData = fgetl( fid );
if isempty( rowData )
emptyRowsIdx = [emptyRowsIdx(:); ii];
continue
end
%*** added by GSS
repIdx = regexp(rowData, '(?:^|,)(?:"((?:[^"]|"")*)"|([^",]*))');
rowData(repIdx(2:end))=';';
rowData = regexp(rowData,';','split');
for j=1:length(rowData)
if ~isempty(rowData{j}) && rowData{j}(1)=='"'
rowData{j}(1)=[];
rowData{j}(end)=[];
end
end
%****end GSS
nDataElems = numel( rowData );

04 Jul 2013 CSVIMPORT CSVIMPORT reads the specified CSV file and stores the contents in a cell array or matrix. Author: Ashish Sadanandan Kreykes, Jason

Some of the entries in the first column of my data contain a comma that should not be interpreted as a delimiter.

For example, the first three rows (with header row) are:
"School","Section Discipline"
"ACS Cogham International HS, UK","Physics"
"Adelphi University","Mathematics"

Can this be accomodated easily?

12 Jun 2013 CSVIMPORT CSVIMPORT reads the specified CSV file and stores the contents in a cell array or matrix. Author: Ashish Sadanandan Duchovny, Dimid

Works great. Thanks you!

Contact us