Importing CSV values and using in different functions App Designer
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello! I want to import a CSV file and format its values to use in multiple functions on App Designer. I want the values I extract from the CSV to be available globally. Since the file is massive (around 2 million rows and 50 columns), I was using datastore but I get multiple errors.
What I have tried so far:
- I created an external matlab file (.m) and tried to import that as a property but failed since it was not a (.mat) file.
- I have tried to code the importing and data formatting in a public property block in the App Designer but that does not recognize ds.
Any suggestion?
댓글 수: 3
dpb
2022년 6월 3일
You'll need to create the datastore object as a public property -- I would guess that should be in the startup code. It would be something more like
function initializeData(app)
app.ds = datastore("filename.csv");
...
where this function is called (or the code can be inline if it's not too complex) in the startup code and the ds variable is defined in the public section.
Then, you reference that global everywhere.
Same idea for the reading -- you pass the datastore handle to the function that does the read when it needs it. This way there's only one instance and it's global.
Would need to see more of the overall organization to write/place specifically, but that's the general idea.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!