Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How to use any2csv - returning "??? Undefined function..."

3 visualizaciones (últimos 30 días)
Ryan tracey
Ryan tracey el 19 de Mzo. de 2012
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hi there,
EDIT: Change from csvwrite to any2csv
I'm very very new to Matlab and have to thank Oleg for pointing out what a struct is but now I am using any2csv.
The layout of my struct contains; cell, double, strings and possibly other variables I don't know of. Here is one of the items from the struct:
>> s(3)
ans =
comm: [1x2 struct]
charge: [36x2 double]
active: [361x2 double]
logtimes: [2x1 double]
on: [40x2 double]
locs: [3195x2 double]
all_locs: [40x1 double]
loc_ids: [3195x1 double]
device_names: {1x6100 cell}
device_macs: {1x6100 cell}
device_date: [1x6100 double]
device_list_names: {1x290 cell}
device_list_macs: [290x1 double]
device_types: {1x6100 cell}
device_list_types: [290x3 double]
cellnames: {4x2 cell}
apps: {1x340 cell}
timeon: 14.6830
app_dates: [1x340 double]
comm_sms: 0
comm_sms_date: []
comm_voice: 2
comm_voice_date: [2x1 double]
comm_data: 0
comm_data_date: []
surveydata: [1x25 double]
my_mac: {'000e6d2a3577'}
my_startdate: {'8/18/2004'}
my_affil: {'1styeargrad '}
my_group: {'sandy'}
my_office: {'384b'}
my_plan: {''}
my_provider: {''}
my_community: {'a little close'}
home_ids: 5.1234e+003
survey_start_n: '24-Jan-2005'
mac: 6.1961e+010
my_minutes: {[NaN]}
my_enddate: 7.3219e+005
my_hashedNumber: []
places: [1x1 struct]
imei: {[NaN]}
neighborhood: {'Boston'}
my_hours: {'9am-12pm*'}
my_regular: {'very'}
my_hangouts: {'nowhere else'}
my_predictable: {'very'}
my_forget: {'occasionally'}
my_battery: {''}
my_sick: {''}
my_sickrecently: {''}
my_travel: {''}
my_data: {''}
my_texts: {''}
my_intros: {'never'}
home_nights: [1x12 double]
comm_local: 2
data_mat: [24x144 double]
I have never used MATLAB in my life, never been taught how to use etc., which is why I ended up here, I have a large .mat file and I want to take the data out so I can play around with it in Java.
This is attempt at using any2csv and the error:
>> any2csv(s,',',0,'s.csv')
??? Undefined function or method 'any2csv' for input
arguments of type 'struct'.
Please help me get this file converted over, thank you!
  7 comentarios
Oleg Komarov
Oleg Komarov el 19 de Mzo. de 2012
You can always update your original post, since this at the moment remains technically unanswered.
Ryan tracey
Ryan tracey el 19 de Mzo. de 2012
Edited

Respuestas (1)

Oleg Komarov
Oleg Komarov el 19 de Mzo. de 2012
You need to add the path where you placed any2csv.m
addpath 'c:\something\...'
Or simply change current folder
cd 'c:\something\...'
Then, MATLAB can "see" what is any2csv and use it.
EDIT
I notice that your structure is complex and has many fields of different types and dimension, not sure it will be able to convert everything. In that case post the error you get.

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by