Alternative to ctrl-c -> ctrl-v three thousand times

回答 (1 件)
0 投票
@OhGodMatlab: judging by your username you need to take a short break and drink a nice coffee. The first thing to remember is that MATLAB is not Excel, and you will have to learn different ways of thinking and problem solving.
In excel formulas are copied everywhere: filled down columns or along rows to work with the data. However in the real world of programming, copy-and-pasting code is sign that you are doing it very wrong. Computers are really only good at doing one thing: repeating simple operations in a loop, so when you find yourself dopy-and-pasting code and making small changes, then you are just doing the computer's job for it (as well as tediously creating code that is complex and hard to maintain).
You need to put all of your data into vectors/matrices/arrays. Use loops or vectorized code as required. Experiment, read the documentation, practice. Use the resources available to you: you are not the first person to simulate a process which changes at fixed points, so find some similar examples and see how they did it. Read this:
Do the introductory tutorials (yes, really), which will show you basic concepts that you need to know:
https://www.mathworks.com/help/matlab/getting-started-with-matlab.html
カテゴリ
ヘルプ センター および File Exchange で Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!