Effacer les filtres
Effacer les filtres

Code organziation during exploratory data analysis?

1 vue (au cours des 30 derniers jours)
Matthias
Matthias le 27 Nov 2014
Modifié(e) : Matthias le 27 Nov 2014
Hello,
I'm interested in how you organize your code for exploratory/preliminary work with complex datasets. Imagine a case where you have some data in the workspace and want to manipulate and plot parts of it, but there's no clear workflow yet -- you're making up your analysis strategy as you go.
For this kind of work, I typically use scripts. I load my raw data into the workspace and then manipulate and plot it using scripts with many sections.
I like how flexible and self-contained scripts are, but it gets complicated when I want to re-use short blocks of code, e.g. for analyzing several variants of my data in parallel. To re-use code, I see two options: anonymous functions and m-file functions. What I'm missing is something in between, namely nested functions within scripts. Often, the code blocks that I want to re-use are too complex to be converted to an anonymous function. But I might have dozens of them in the same script, and I don't want to maintain a mess of function files that are quickly getting out-dated and are more cumbersome to edit than code that's directly within the script file.
So how do you handle this situation?
  • Do you copy/paste code and edit it manually?
  • Do you create many little function files?
  • Am I wrong using scripts in the first place?
  • How does MathWorks envision work like this to be done?
Thanks, Matthias

Réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by