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 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Image Analyst
am 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 Kommentare
Siehe auch
Kategorien
Mehr zu Programming Utilities 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!