How to define cell arrays that their elements are extracted from a Dataset?

1 visualización (últimos 30 días)
I have two 29*1 cells in my Matlab workspace (they were two columns in my excel dataset with the names: Assignee & Reporter that I imported them to Matlab workspace as two cells). I attached my excel dataset here. my aim is to scroll these two cells by two counters (i & j ) and compare them in the way that if two reporters cell elements are similar while their assignee cell elements are not the same so these two Assignee elements will be two nodes in my graph and communicate by an edge. but there is a problem in defining the cells Assignee and Reporter. I wrote these lines:
load firefox.mat
s={};
t={};
G=graph(s,t);
%Assignee=table(Assignee); ???
Assignee=cell(); ???
Reporter=cell(); ???
for i=2:29 %my Dataset has 29 rows
for j=2:29
if Assignee(i)~=Assignee(j)
if Reporter(i)==Reporter(j)
s={Assignee(i)};
t={Assignee(j)};
g=graph(s,t);
break;
end
break;
end
end
end
Plot(G);
I'll be very grateful if suggest me what is the correct method for this problem?or how the lines must modify to create the graph correctly?
  4 comentarios
Guillaume
Guillaume el 26 de Abr. de 2018
Again: give an example of inputs (attach the excel file for example) and desired output.
Undefined function or variable 'filename'. Seems pretty straightforward to solve. Create that filename variable (containing the path of the file).
phdcomputer Eng
phdcomputer Eng el 30 de Abr. de 2018
My input is an excel dataset which I attached to this comment. My desired output is to create an undirected weighted graph based on this excel dataset in Matlab. more explanation: Each node represents a stakeholder, the edge shows communication among two stakeholders and its weight indicates the total instance of communication between them. I will be grateful to have any similar examples or related link in this field.

Iniciar sesión para comentar.

Respuesta aceptada

Guillaume
Guillaume el 30 de Abr. de 2018
I'm not very clear on what the edges and nodes in your graph should be. If the edges are defined simply by the pair Assignee and Reporter, then this is easily done:
t = readtable('firefox.xlsx');
g = graph(t.Assignee, t.Reporter);
plot(g); %to see the graph
  4 comentarios
phdcomputer Eng
phdcomputer Eng el 7 de Mayo de 2018
very grateful Yes, that's right but I just have the excel dataset as the input and I don't have weights matrix, Do you think it is possible to calculate weights matrix from excel dataset? the other problem is that this graph can be made for 30 rows of data but for more, I receive this error: Error in thefirefox100 (line 9) g = graph(t.Assignee, t.Reporter ); I'm very thankful for your great help.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graph and Network Algorithms 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