C code to Matlab code

Hi,
i have this C code:
#include <stdio.h>
int main() {
char znak;
int carky=0;
while (1==1) {
scanf("%c", &znak);
if (znak==',') carky=(carky+1)%4;
if (znak==',' && carky==0) printf(",\n"); else printf("%c", znak);
}
return 0;
}
and I need translete this code to matlab. It is possible ?
Thanks

Respuestas (1)

Walter Roberson
Walter Roberson el 31 de Mzo. de 2019

0 votos

No. That code reads from stdin (standard input). MATLAB does not have any stdin (standard input).
Note: the code as written would repeat the last character of stdin indefinitely, with the exception that if the last character happened to be comma then it would output four commas then newline, indefinitely often. The code as written has no way to detect end of input.

Categorías

Más información sobre Software Development Tools en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 27 de Mzo. de 2019

Respondida:

el 31 de Mzo. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by