Files
bartels-rausch e5226802a3 Add project dependency tracking system with yEd and PNG export
- Implement @DEP_IN/OUT/RUN tag standard for MATLAB script metadata
- Add buildDependencyGraph.m for full project mapping and yEd (.tgf) export
- Add plotSingleFileDependencies.m and plotNodeHistory.m for targeted analysis
- Standardize output naming convention to 'Dependency_*' for Finder organization
- Configure high-resolution PNG export as default static fallback
2026-04-02 10:56:28 +02:00

48 lines
1.4 KiB
Matlab

function saveFilename = nappSaveDataTable(DataTable, options)
arguments
DataTable table
options.suffix char = ""
options.varName char = ""
end
currentScriptName = '';
% 1. Determine script name (Your existing logic is solid here)
stackInfo = dbstack;
if length(stackInfo) > 1
[~, currentScriptName, ~] = fileparts(stackInfo(2).file);
if contains(currentScriptName, 'LiveEditorEvaluationHelper')
currentScriptName = '';
end
end
if isempty(currentScriptName)
try
[~, currentScriptName, ~] = fileparts(matlab.desktop.editor.getActiveFilename);
catch
currentScriptName = 'ManualRun';
end
end
% 2. Generate the final filename
saveFilename = sprintf('%s%s.mat', currentScriptName, options.suffix);
% 3. Determine the variable name
% Priority: 1. Manual override, 2. inputname, 3. Default 'DataTable'
if options.varName ~= ""
finalVarName = options.varName;
else
finalVarName = inputname(1);
if isempty(finalVarName)
finalVarName = 'DataTable';
end
end
% 4. SAVE
% We create a struct where the field name is our dynamic string.
% Then we save the struct with the '-struct' flag.
saveData.(finalVarName) = DataTable;
save(saveFilename, '-struct', 'saveData');
fprintf('✅ Successfully saved %s to: %s\n', finalVarName, saveFilename);
end