Double = in one line of code

2 visualizaciones (últimos 30 días)
Zeynab Mousavikhamene
Zeynab Mousavikhamene el 13 de Ag. de 2019
Comentada: James Tursa el 13 de Ag. de 2019
Can I define a=b=c in one line of code in matlab? if yes what is the syntax?
I do not want to define in double section like a=b; c=b;
  1 comentario
James Tursa
James Tursa el 13 de Ag. de 2019
What do you have against a=b; c=b; ?

Iniciar sesión para comentar.

Respuestas (2)

madhan ravi
madhan ravi el 13 de Ag. de 2019

Andrei Bobrov
Andrei Bobrov el 13 de Ag. de 2019
b = 1000;
zz = {b};
[a,c] = zz{[1,1]};
  1 comentario
Rik
Rik el 13 de Ag. de 2019
Nice hack, although I think deal is more clear when reading the code. I didn't know this syntax also generated a comma-separated list like {:} does.

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by