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 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Image Analyst
2011-11-6
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Programming Utilities 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!