Home > Archive > Matlab > April 2005 > The Null statement
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
The Null statement
|
|
|
| Hi all,
trying to make my gui program to check if there is charcters in a
variable or not, like this:
%One part of the program defining the variabel f and p
%f and p are global variables
[f,p]=uiputfile({'*.mat'},'Set a name', 'test_m.mat')
fullfile(p,f);
%The other partof program, a save button
global f dm1 dm2 r tao
dm = [dm1 dm2 0; r tao 0;0 0 0];
if (f == NULL)
%works in ansi c ;) here shall check after charcters
error('could not open file');
else
save(f, 'dm')
end;
Any one that has an idea to solve it?
looking into the switch function, but not the obvious choice for me
that has mostly programmed in c.
BR,
Newt
| |
|
|
|
| Has reviewed what you suggested, but dosen't work that either, when
debugging it the program dosen't come to the first statement in the
if loop, checking it it isequal, here is my current code, for the the
second part:
________________________________________
______
global f p dm1 dm2 r tao
%Stores the global variables into a matrix
%Defining of variables position in matrix
dm = [dm1 dm2 0; r tao 0;0 0 0];
if isequal(f,0) | isequal(p,0)
disp('Error, no specified file to save to!')
%Dosen't come into this part of the program even if f=[]
else
save(f, 'dm')
end
________________________________________
______
Jérôme wrote:
>
>
> Hi,
>
> did you read the documentation about uiputfile, especially t the
> last
> lines ?
>
> help uiputfile
> <http://www.mathworks.com/access/hel.../uiputfile.html>
>
> Jérôme
| |
| Herbert Ramoser 2005-04-25, 4:02 pm |
| Newt wrote:
> Hi all,
>
> trying to make my gui program to check if there is charcters in a
> variable or not, like this:
>
> %One part of the program defining the variabel f and p
> %f and p are global variables
> [f,p]=uiputfile({'*.mat'},'Set a name', 'test_m.mat')
> fullfile(p,f);
>
> %The other partof program, a save button
> global f dm1 dm2 r tao
> dm = [dm1 dm2 0; r tao 0;0 0 0];
>
> if (f == NULL)
> %works in ansi c ;) here shall check after charcters
> error('could not open file');
> else
> save(f, 'dm')
> end;
>
> Any one that has an idea to solve it?
> looking into the switch function, but not the obvious choice for me
> that has mostly programmed in c.
help isempty
-Herbert
| |
|
| Herbert Ramoser wrote:
>
>
> Newt wrote:
a[color=darkred]
for[color=darkred]
> me
>
> help isempty
>
> -Herbert
>
Thanks for the tip it works =)
/Newt
| |
| Jérôme 2005-04-25, 4:02 pm |
| What's happen if you use the "cancel" button during uiputfile ?
Then f=0 so isempty won't see the problem !
You have to mix both solutions
Jérôme
| |
|
| Don't have a Cancel button, and use only charcters in the variables f
and p, so don't see the point of that concern.
Have I missunderstood what you meant?
Newt
Jérôme wrote:
>
>
> What's happen if you use the "cancel" button during uiputfile ?
>
> Then f=0 so isempty won't see the problem !
> You have to mix both solutions
>
> Jérôme
| |
| Jérôme 2005-04-25, 4:02 pm |
| Newt wrote:
>
>
> Don't have a Cancel button
There is a "cancel" button when you are using uiputfile.
Did you try to use it ?
Jérôme
| |
|
| Hi Jérôme,
ok, there IS a cancel button, and it caused quite many new errors :/
but has solved them now =) i think. Used both isequal and isempty....
/Newt
Jérôme wrote:
>
>
> Newt wrote:
>
> There is a "cancel" button when you are using uiputfile.
> Did you try to use it ?
>
> Jérôme
|
|
|
|
|