I'm trying to define an anonymous function using an "if" statement. Here is a minimum "not working" example (my code is more convoluted, but this illustrates the issue):
else h=@(x) g(x)
The point is that I don't want to create an m file and have to recompute both f and g in it (my actual problem would require recomputing many more). So the question is:
1-) Is it possible to create an anonymous function using "if" statements (fixing the code above)?
2-) Is it possible to define function h on a separate m file, without having to recompute f and g inside of it?