- introducing bugs, which then cannot be reverted because you have changed the original file and you no longer have an original version.
- changing function behavior and outputs: other functions may depend on the one that you edit. Will they still work correctly ? How do you know ?
How to edit MATLAB file kmeans.m?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello Friends,
I want to edit kmeans.m but it does not allow me to make any changes. I tried 'fileattrib' to make it writable file by
fileattrib('kmeans.m', '+w');
but even this does not work. I also tried to give the full path as follows:
fileattrib('/usr/local/MATLAB/R2014a/toolbox/stats/stats/kmeans.m','+w')
Error using fileattrib
Operation not permitted
I will appreciate any advise.
1 Kommentar
Stephen23
am 9 Aug. 2016
Bearbeitet: Stephen23
am 9 Aug. 2016
Do NOT edit or change any MATLAB toolbox files.
This has two very significant risks:
If you want to write some code based on a MATLAB toolbox file, always copy it to your user directory and work with that copy only. Never replace the original files.
Antworten (1)
the cyclist
am 8 Aug. 2016
I would strongly advise against directly editing a read-only MATLAB file.
Instead copy it to your own directory, and edit your own file ...
copyfile /Applications/MATLAB_R2016b.app/toolbox/stats/stats/kmeans.m ./my_kmeans.m
It will still be read-only, but after make changes and try to save, you will be given an option to overwrite.
2 Kommentare
Adam
am 9 Aug. 2016
You would have to copy them in that case. Matlab toolbox files are not meant to be messed around with and edited.
Siehe auch
Kategorien
Mehr zu File Operations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!