- The command window is great for trying new things out or investigating a new data set, but can get tiresome if developing code requires repeating (almost) the same function calls.
- Scripts are great for keeping together your working code, keeping the sequence of processing correct, as well as providing a place to make notes and comments (very important!). Most importantly scripts are the basic file-based storage of your work, so you can keep/archive/send/... your code.
Loading a .csv into a script
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Andrew MG
am 10 Okt. 2014
Beantwortet: Stephen23
am 10 Okt. 2014
For a project, I have been given a script that requires I load a .csv file into in order for me to run it.
fid = fopen(csv_filename); line = fgetl(fid); n = 0;
I'm new to programming in general and don't know whether I am supposed to import via the command window or actually type the file name into the script and run.
0 Kommentare
Akzeptierte Antwort
Stephen23
am 10 Okt. 2014
"whether I am supposed to import via the command window or actually type the file name into the script and run."
Either of these will work.
Almost all commands in MATLAB can be called in the command window or in a script or in a function. It depends entirely on what you want to do.
0 Kommentare
Weitere Antworten (1)
José-Luis
am 10 Okt. 2014
Please read the documentation. The function csvread() does what you want.
doc csvread
0 Kommentare
Siehe auch
Kategorien
Mehr zu Large Files and Big Data 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!