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!