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!