the following command returns how many Inf's are in a vector
Tuesday, January 29, 2008
count how many Inf's are in a vector
Posted by
otmezger
at
9:11 AM
2
comments
Labels: matlab
ckeck if a variable exist
To ckeck if a variable in matlab exist, just use the function exist.
Posted by
otmezger
at
7:20 AM
0
comments
Labels: matlab
Tuesday, January 8, 2008
Delete sheets without confirmation prompts using VBA in Excel
Hi people,
i was searching for a way to delete a worksheet without confirmation prompt in vba and i found this link.
the code is listed here:
Sub DeleteSheet(strSheetName As String)
' deletes a sheet named strSheetName in the active workbook
Application.DisplayAlerts = False
Sheets(strSheetName).Delete
Application.DisplayAlerts = True
End Sub
Posted by
otmezger
at
2:41 PM
0
comments
Labels: vba
Wednesday, December 12, 2007
export a matlab figure or simulink modell to powerpoint
Hi people
today i have something nice! i needed to export a simulink modell to powerpoint, and i did not want to make a screen shot. the clue is saveppt.
to use the program, i typed:
Posted by
otmezger
at
11:03 AM
0
comments
Labels: matlab
Wednesday, December 5, 2007
check if a excel workbook is open
hi people, today, i discovered this function. it is very usefull, thanks to the authors.
the link to the function is here.
and the function is here:
Function WorkbookOpen(WorkBookName As String) As Boolean
' returns TRUE if the workbook is open
WorkbookOpen = False
On Error GoTo WorkBookNotOpen
If Len(Application.WorkBooks(WorkBookName).Name) > 0 Then
WorkbookOpen = True
Exit Function
End If
WorkBookNotOpen:
End Function
to call this function, use for example:
If Not WorkbookOpen("MyWorkbookName.xls") Then
Workbooks.Open "MyWorkbookName.xls"
End If
Posted by
otmezger
at
11:48 AM
0
comments
Labels: vba
Monday, December 3, 2007
vba function to calculate the column value from a number
Hi, this function returns a script, which contains the value of the columns for excel. for example, if you call MyColumn(1), you'll get the string "A". If you call MyColumn(27), you'll get "AA".
Function myColumn(column As Integer) As String
'******************************
' author: tomas mezger
' tmezger_at_ffe.de
' date: 12.10.2007
'******************************
' this function returns a script, which contains the value of
' the columns for excel
' for example,
' MyColumn(1) = A
' MyColumn(26) = Z
' MyColumn(27) = AA
' MyColumn(100) = CV
' MyColumn(256) = IV
' MyColumn(257) = NULL <--- Error. Excel has only 256 columns!!!!
Dim column1 As Integer
Dim column2 As Integer
column2 = (column - 1) Mod 26 + 65
'MyColumn2 = Chr(column2)
' das liefert das hintere Teil des Bezuges
If column > 256 Then
myColumn = "NULL"
MsgBox ("Error, column must be <= 256 !!!")
Else
If column <= 26 Then
myColumn = Chr(column2)
Else
column1 = WorksheetFunction.RoundDown(((column - 1) / 26), 0) + 64
myColumn = Chr(column1) & Chr(column2)
End If
End If
End Function
Posted by
otmezger
at
1:19 PM
0
comments
Labels: vba