Loading and working with Data in Appdesigner

7 views (last 30 days)
Hi there,
I'm currently working on my first app designer project and the general idea is to create an app where the user can import, export and plot some Data. Later on the app should get more comfortable but for the first try two buttons and one plot should do the work. The Data is stored in a MS Office comma separated Values File but the problem is that the data varies from measurement to measurement e.g. it can look like this:
  • Date,Time,Peak Counts,Total Counts,...
  • 11/30/2017,23:03:56.921,5827956.35,4726.70,...
  • .
  • .
  • .
  • Name,Mean,StdDev,Sample Size
  • Total,5738923.91,12795.09,10000.00
  • Peak,4681.84,24.19,10000.00
So depending on how many (and what kind of) columns I've got in the Data I also get sth. like a footmark, which has no important information and I don't want to plot or export. I already wrote a Matlab function where the user can select the csv file and the data gets manipulated in a suitable way. First question: I'm working with textscan which performs okay but needs some time (whole function needs like 4-5secs for 38k rows and 11 columns) to read the data into an cell array. After that I also need to transform the data type from char to e.g. datetime, datenum or double. Is there a faster and more elegant way to do that?
Because I can't know how many and what kind of output (number of columns with different information) I want to get from that function I thought about splitting the loading and manipulating from the Data in two parts. Loading the Data with a function into the AppDesigner environment works just fine with this code:
properties (Access = private)
dataArray % Description
end
methods (Access = private)
% Button pushed function: ImportButton
function ImportButtonPushed(app, event)
[app.dataArray] = SelectAndImportCSV1();
end
end
How can I continue to work with that dataArray (could be e.g. a 1 * 11 cell, where each cell itself is a 38k * 1 cell and each cell contains a char e.g. 'date') in AppDesigner? I think the best way at this point is to transform the data into a suitable format and store them in some vectors so I can plot what I want to see in an easy way later on. Is this in general a good way to work in app designer? Or is there a possibility in Matlab to create a function where the output differs from time to time depending on how many columns I got in the data?
I hope I made clear what my problem is =)
Best regards and thanks in advance for your help

Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!