Attempting to build a function, but i have a large matrix in the workspace that i need to call on in order for the function to work properly.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Essentially I am trying to build a function out of an old mfile i have been using. When i run the mfile i call on predefined values which i load into the workspace, however when i try to make this mfile into a function this technique no longer works. The values in the workspace are large matrices of dimensions 360x40 so trying to write them out within the function itself is a hassle. I am still new to matlab so i was wondering what the most effective way would be to make the function be able to call on these matrices.
0 Commenti
Risposte (1)
Image Analyst
il 6 Nov 2011
You need to pass your variables in the base workspace into your new function as input arguments. It used to be a script so it could access the base workspace. Now, as a function, it can no longer do that so you must pass in those variables as input arguments. Make sense?
For the record, those are actually very tiny arrays. I mean, even a garden variety digital image these days is 4000 x 3000 x 3 and even that can be handled with no problem. Trust me - nothing is going to choke on your arrays because of their size.
0 Commenti
Vedere anche
Categorie
Scopri di più su Programming Utilities in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!