Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Cell Array of Strings function help

1 vue (au cours des 30 derniers jours)
krushnasamy subramaniyan
krushnasamy subramaniyan le 6 Juin 2015
Clôturé : Walter Roberson le 15 Juin 2015
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 commentaires
James Tursa
James Tursa le 6 Juin 2015
Modifié(e) : James Tursa le 6 Juin 2015
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 le 6 Juin 2015
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...

Réponses (0)

Cette question est clôturée.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by