Borrar filtros
Borrar filtros

is it o.k if 'tic' is in one function and 'toc' is in another?

4 visualizaciones (últimos 30 días)
is it o.k if 'tic' is in one function and 'toc' is in another? I am working with a gui and I want to set tic in one place and toc in a different function, possible?

Respuesta aceptada

Matt Fig
Matt Fig el 15 de Oct. de 2012
Editada: Matt Fig el 15 de Oct. de 2012
Yes, tic is global. Here is an example I made to test....
Example. 1st M-file:
function [] = calltic()
tic;
Second, separate M-file:
function [T] = calltoc()
T = toc;
From the command line:
>> calltic,calltoc
ans =
1.1999e-004
>> calltic,pause(.998),calltoc
ans =
1.0001

Más respuestas (1)

Image Analyst
Image Analyst el 15 de Oct. de 2012
Wouldn't it be easy enough to try? Then you'd find out, probably quicker than asking here.
  2 comentarios
Matt Fig
Matt Fig el 15 de Oct. de 2012
My first thought....
alex
alex el 15 de Oct. de 2012
all I'm asking here is after playing with those things myself.. the problem is that I keep on heving an error while running that says-
Error using toc
You must call TIC without an output argument before calling TOC without an
input argument.
Error in hand_rotation2/youPress (line 126)
c = toc;
Error while evaluating figure KeyPressFcn
so I thougth it could somehow be because of it..

Iniciar sesión para comentar.

Categorías

Más información sobre Debugging and Analysis 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