Grouping into a table
Mostrar comentarios más antiguos
Hi guys
I have a loop here that returns this:

I want all of these grouped in the same place, one after another... instead of generating a different table each time
This is the code I used to generate it
document1 = "Analyst Actions: Citigroup Cuts Fiverr International's Price Target to $22 From $31, Reiterates Neutral Rating";
document2 = "Analyst Actions: JPMorgan Downgrades Beyond Meat to Neutral From Overweight, Cuts Price Target to $134 From $138";
document3 = "Analyst Actions: Credit Suisse Raises Beyond Meat's Price Target to $125 From $115; Keeps Neutral Rating";
document4 = "Analyst Actions: Oppenheimer Initiates Coverage on Beyond Meat With Perform Rating";
document5 = "Analyst Actions: Morgan Stanley Trims GoPro's Price Target to $3.50 From $4.50, Maintains Underweight Rating";
document6 = "GoPro downgraded by Zacks Investment Research to strong sell. $3.75 PT. (NASDAQ:GPRO)";
document7 = "Analyst Actions: BofA Merrill Lynch Upgrades Fiverr International to Buy From Neutral";
% data is a table containing all documents in a str form
data = table(document1,document2,document3,document4,document5,document6,document7)
issuer = ["JPMorgan";
"Citigroup";
"Credit Suisse";
"Oppenheimer";
"Morgan Stanley";
"Zacks";
"BofA"
"Merrill Lynch";
"Bank of America"];
tblnames = {'Text', 'Issuer'};
sz = (size(data))
rows = sz(1)
columns = sz(2)
N = columns
K = size(issuer)
for idx = 1:N % for as long as idx is 1 to the # of N
scan = data{:,idx}; % scan the documents in data
for i = 1:K % go over all K issuers
if (contains(scan,issuer(i)))
x = issuer(i);
tbl = table(scan,x,'VariableNames',tblnames)
else
"No Match.";
end
end
end
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Risk Management Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!