Borrar filtros
Borrar filtros

Creating new array from individual string outputs

1 visualización (últimos 30 días)
Joseph
Joseph el 10 de Nov. de 2014
Respondida: Image Analyst el 10 de Nov. de 2014
I'm trying to write a script that looks through two excel documents and finds strings that are in the first document but aren't in the second. I have been successful in doing this, however I can't figure out how to display the strings in a new array. This is what I have so far:
if true
% code
end
[num1,excel1,raw1] = xlsread('excel1');
[num2,excel2,raw2] = xlsread('excel2');
end
names1 = excel1(:,1);
names2 = excel1(:,1);
for k = 1:length(names);
match = strmatch(names1(k),names2);
if rem(match,1) == 0
else x = names1(k)
end
end

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 10 de Nov. de 2014
Editada: Azzi Abdelmalek el 10 de Nov. de 2014
end
[num1,excel1,raw1] = xlsread('excel1');
[num2,excel2,raw2] = xlsread('excel2');
end
names1 = excel1(:,1);
names2 = excel1(:,1);
x={}
for k = 1:length(names);
match = strmatch(names1(k),names2);
if rem(match,1) == 0
else x(end+1) = names1(k)
end
end

Más respuestas (1)

Image Analyst
Image Analyst el 10 de Nov. de 2014
What do you mean by "how to display the strings"? Some ways:
  1. You can use fprintf(),
  2. Or just put the name of the array on its own line and it will spit it out to the command window.
  3. Or you can just look in the variable editor (double click on the variable name in the workspace to bring it up) and it will display it for you in a table/grid/spreadsheet style.
  4. Or you can use the function celldisp().
Would one of those ways work for you? There are other ways if you want to use a GUI, such as
  1. an edit box,
  2. a static text label,
  3. a uitable,
  4. a listbox, etc.

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by