Turn the output of a script into a cell array?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello, so I have this script...
PathName = ('T:\10 - VEHICLE TESTING RESULTS\2011 KENWORTH ISX15\10 - CANAPE FILES\1307\MAT_raw');
matdatesearch1(PathName); %# of uploaded files from last day
matdatesearch3(PathName); %# of uploaded files from last 3 days
matdatesearch7(PathName); %# of uploaded files from last week
disp('Last location:');
a = LatestFileUploaded(PathName);
load(a);
lat = CAN2_CAN_GPS_1_GPS_Y(end);
lon = CAN2_CAN_GPS_1_GPS_X(end);
GetGPSLocation(lat, lon)
cd(PathName);
disp(' ');
LatestFile(PathName); % The latest file uploaded
disp(' ');
LastMovement(PathName); %Last time truck moved -- last time vehicle speed was > 0
As you can see, the script contains different functions. The output of the script looks like this...
Number of files in the last day:
3
Number of files in the last 3 days:
16
Number of files in the last 7 days:
48
Last location:
720 Aero Drive, Buffalo, NY 14225, USA
Buffalo, NY 14225, USA
Cheektowaga, NY, USA
Cheektowaga, NY, USA
Erie, NY, USA
United States,
New York, USA
United States
Latest file uploaded:
20130729_SPLBRENT3_081610.mat
Last time truck moved:
29-Jul-2013 10:13:32
Does anyone know how I have the output of my script come as a cell array? I tried a few different things but nothing seems to work. Thanks in advance!
3 comentarios
Cedric
el 30 de Jul. de 2013
Editada: Cedric
el 30 de Jul. de 2013
I think that I understand.. you took the output of one of the methods described here
as last location and you don't understand why you have multiple locations? If this is the issue, read well my answer in this former thread, because I explain why, as well as what should be done next to filter locations (which implies working quite a bit on understanding the Google Geocoding API and its XML output).
Respuesta aceptada
Cedric
el 30 de Jul. de 2013
Editada: Cedric
el 30 de Jul. de 2013
If the question is not: how to filter the cell array
720 Aero Drive, Buffalo, NY 14225, USA
Buffalo, NY 14225, USA
Cheektowaga, NY, USA
Cheektowaga, NY, USA
Erie, NY, USA
United States,
New York, USA
United States
but: how to build a cell array with all the information that is currently displayed on screen, the solution is to make these various functions that you are calling output information instead of (or in addition to) displaying it.
For example, instead of having
function matdatesearch1(PathName)
% Code for computing the number of files: nFiles.
disp(nFiles) ;
end
and a call like
matdatesearch1(PathName);
which displays the result but doesn't store it anywhere, you update a little the function so it returns nFiles :
function nFiles = matdatesearch1(PathName)
% Code for computing the number of files: nFiles.
disp(nFiles) ;
end
and you store the output wherever you want when you call the function, e.g. in a struct:
result.nFiles1day = matdatesearch1(PathName) ;
or in a numeric variable
nFiles1day = matdatesearch1(PathName) ;
that you can then store in a cell array..
result = {nFiles1day, nFiles3days, nFiles7days, etc} ;
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Biological and Health Sciences en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!