フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Cell Array of Strings function help

1 回表示 (過去 30 日間)
krushnasamy subramaniyan
krushnasamy subramaniyan 2015 年 6 月 6 日
閉鎖済み: Walter Roberson 2015 年 6 月 15 日
Write a function called censor whose first input argument is a cell vector (row or column) of strings and whose second input argument is a string. It removes each element of the cell vector whose string is either identical to the second input argument ... (PLEASE FINISH THIS STATEMENT HERE)
function mystr=censor(str,substr)
str={str};
element=substr;
str(strcmp(str,element))='';
for i=1:length(str)
if iscell(str{i})
str{i}(strcmp(str{i},element))='';
end
end
  3 件のコメント
James Tursa
James Tursa 2015 年 6 月 6 日
編集済み: James Tursa 2015 年 6 月 6 日
I have edited your question and moved the title inside the question itself. It looks incomplete, so please edit and replace my TEXT above with the remaining question, and then tell us what specific problems you are having. Then we can help you. E.g., does it give you an error (if so, post the entire error for us to see), does it give you wrong results, etc.
Thanks for making an effort and posting your attempt.
dpb
dpb 2015 年 6 月 6 日
Is this not the duplicate of http://www.mathworks.com/matlabcentral/answers/221886 where you've been given several hints that haven't followed up on?
As noted there, the substitution for the string in the cell is NOT the proper operation with which to begin per the problem statement as given in one of the follow-ups at that thread.
Continue the conversation in one thread only, please...

回答 (0 件)

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by