add for loop in matlab code

s = [2 10 10 113 119 119 54 119 119 168 271 271 271 271 271 474 37 54 113 37 168 10 168 99 10 1632 37 1127 10 1127 2 113 4 2 1 1632 2 2 1 505 121
];
t = [402 970 271 54 2 54 119 471 271 74 2 54 113 119 471 37 474 37 37 113 10 168 439 10 99 37 1632 113 2 2 1127 4 113 168 113 2 10 1632 2 121 505
];
weights = [1 8 8 4 8 5 5 9 8 1 8 7 7 8 1 1 1 5 2 5 2 2 1 2 2 2 1 1 8 1 1 5 3 9 2 3 3 2 1 1 1
];
G = digraph(s,t,weights,1632)
plot(G)
full(adjacency(G))
i need to add excel data in this code.example in excel source data added s array , target add t array and rating add weight to get graph and matrix .its change month by month .firstly added KASIM10 AFTER THEN it will be show graph and matrix after then new graph for ARALIK10 .

7 comentarios

Bob Thompson
Bob Thompson el 2 de Mzo. de 2018
What exactly are you looking for help with? Just all of the needs listed in the paragraph?
Walter Roberson
Walter Roberson el 2 de Mzo. de 2018
What is KASIM10 and ARALIK10 ?
gkn dmr
gkn dmr el 3 de Mzo. de 2018
Editada: Walter Roberson el 3 de Mzo. de 2018
Walter Roberson
Walter Roberson el 3 de Mzo. de 2018
Okay, so why not just use xlsread to read an array, divide it into columns, and call digraph() with the data?
gkn dmr
gkn dmr el 3 de Mzo. de 2018
teacher wants to for and if using in code .they want only one code.
Walter Roberson
Walter Roberson el 3 de Mzo. de 2018
You have no realistic hope of reading excel data with code you write yourself without writing at least one function: the format of .xls and .xlsx files is much too complicated to write your own code for that does not use functions.
So read the data using xlsread(). You can use a for loop to examine the data if you want. There is more than one way to represent dates in Excel so I do not know at the moment whether the "human time" column will be represented as a string or as numeric, but you probably just need to look for places that it changes
gkn dmr
gkn dmr el 3 de Mzo. de 2018
how can i use for loop for excel data , can you give example

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 2 de Mzo. de 2018

Comentada:

el 3 de Mzo. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by