필터 지우기
필터 지우기

Result only printed on screen and show in the ans variable in the workspace

조회 수: 2 (최근 30일)
This is my code, it read the entire text file and search for a specific word and returns the line that contains that words using token in a cell array. The problem is my assigned variables are not returned not showed in the workspace of my function....
ans: result

채택된 답변

Amit
Amit 2014년 1월 18일
If the assigned variables in your code are different than sortedWords, they wont show up in the workspace because they are only for this function.
In order to have then in the workspace, you either need to set them as an output of the function like
function [sortedWords,AssignVal1 ... ] = readFromGigaWord(sortedWords,count)
or you need to run this not as a function but a script.
  댓글 수: 4
KnowledgeSeeker
KnowledgeSeeker 2014년 1월 18일
As you mentioned Amit. I better run it as a script
Amit
Amit 2014년 1월 18일
I would think that would be better.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 1월 18일
You can use allwords() http://www.mathworks.com/matlabcentral/fileexchange/27184-allwords to parse your sentence into separate words. It's a heck of a lot easier than using strtok().
Then you can use strfind() to look for a particular word.

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by