Sie verfolgen jetzt diese Frage
- Aktualisierungen können Sie in Ihrem Feed verfolgter Inhalte sehen.
- Je nach Ihren Kommunikationseinstellungen können Sie auch E-Mails erhalten.
is Matlab code a lot faster than Excel formulas?
6 Kommentare
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
Akzeptierte Antwort
26 Kommentare
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
- it's worth it to code the spreadsheet - although this use case may not be typical, there will be others in the future, it's worth the investment
- it will likely increase iteration speed - it seems that the concept of coding a spreadsheet to improve speed is sound (with caveats)
- caveat: the code will need to be well-written - a 1:1 translation of the spreadsheet will probably not produce the desired result
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
- Most of my data is double precision, but COM imports it as a cell matrix. cell2mat() seems to work, but I know from my searching that there are other solutions, using (i.e. [C{:}], C++ MEX) which are faster or more elegant. How would you convert these cell matrices to double precision matrices?
- The size of my SORT, CLOSE and DATA matrices will vary depending on the size of the dataset. I found this method (which you had input on) for importing data sets of varying size. Is there another way to do this without using keystrokes?
-
Verknüpfen
Direkter Link zu diesem Kommentar
- Yes, the .Value property is always returned as the VBA Variant type which is a cell array in MATLAB parlance. My recommendation would be to develop the code first using normal MATLAB functions and only worry about fine-tuning performance once you have a working algorithm and can profile it to find bottlenecks. So, I'd start with cell2mat and stick with it until it was proven to be a significant source of overhead. It's SO much easier to debug simple-to-read, "deadahead" code than to also have to fight through arcane manipulations and remember what was the purpose of such machinations. You might save a few msec here, but I'll be very surprised to learn it turns out to be a significant fraction of the overall run time. After all, this is only a one-time thing on startup, isn't it?
- Yes, there are ways, but not magic ones. You'll have to have some sort of breadcrumbs to lead through the forest; if your spreadsheet has header rows to identify where things are, then one ploy is to first read the header row(s) and locate columns by finding specific variable names columns. Failing that, it becomes more difficult and would have to have details of the spreadsheet content that could somehow be used as waypoints to have any further insight. I'll refloat the previous idea to move completely away from the huge single spreadsheet paradigm, however, and go back to the source of the original data from which the spreadsheet was/is created and read it from those sources. Then it should already be of the given size and content without having to break it back out again.
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
- your points about not making a 1:1 translation from Excel -> Matlab are fully understood. I think the confusion was my assumption that I would have to adapt the way a spreadsheet does things to the way they can be done in code, so I never planned a "literal 1:1" translation.
- although this was not mentioned before, there is existing code that provides data which the spreadsheet uses, and it is written in C++. I'm not an experienced C++ coder (or experienced in coding at all), but I did write the code and can work in that environment. From what you all have said, C++ is very likely faster than Matlab.
- I've been taking time to modify the spreadsheet in preparation for converting it to code. Much of what has accumulated over time has been removed, and much of what is helpful has been kept and even fine-tuned. That's what I'm working on mainly now.
- For the moment, I think the wisest course of action, if speed is most important, is to make the (deeper) plunge into C++. It's not what I wanted to do, because I have a Matlab license available to me and a wonderful community to help, but it seems wise.
Weitere Antworten (1)
2 Kommentare
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
Siehe auch
Kategorien
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Es ist ein Fehler aufgetreten
Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asien-Pazifik
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)