Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Cell Array of Strings function help

1 visualizzazione (ultimi 30 giorni)
krushnasamy subramaniyan
krushnasamy subramaniyan il 6 Giu 2015
Chiuso: Walter Roberson il 15 Giu 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 Commenti
James Tursa
James Tursa il 6 Giu 2015
Modificato: James Tursa il 6 Giu 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 il 6 Giu 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...

Risposte (0)

Questa domanda è chiusa.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by