|
Hello,
I am trying to connect c# with MATLAB. I used the deploytool in MATLAB to get the dll file to be used in my c# application. I followed the steps by step example from
MATHWORKS tells for its connectivity with c#[^].
After building my c# project, when I run, it stops working and shows run time exception as follows:
Unhandled Exception: System.TypeInitializationException: The type initializer for 'test.testclass' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT:0x8007000B)
at MathWorks.MATLAB.NET.Utility.MWMCR.mclInitializeApplication(String[] start
upOptions, Int32 startupOptionsCount)
at MathWorks.MATLAB.NET.Utility.MWMCR.InitializeApplication(String[] startupOptions)
at test.testclass..cctor()
--- End of inner exception stack trace ---
at test.testclass..ctor()
at mainApp_test.Program.Main(String[] args) in C:\Users\Abro\Documents\Visual
Studio 2008\Projects\mainApp_test\mainApp_test\Program.cs:line 44
Press any key to continue . . .
Can anyone help me solving this problem?
I am using MATLAB version 7.3, visual studio 8, windows 7 home premium, 64-bit operating system
my c# code is:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using test;
using MathWorks.MATLAB.NET.Arrays;
using MathWorks.MATLAB.NET.Utility;
namespace mainApp_test
{
class Program
{
static void Main(string[] args)
{
testclass obj = null;
double[] a = new double[1] { 10 };
double[] b = new double[1] { 33 };
MWNumericArray mwnA = new MWNumericArray(a);
MWNumericArray mwnB = new MWNumericArray(b);
MWArray[] result =null;
try
{
obj = new testclass();
result = obj.addMatlab(mwnA,mwnB);
MWNumericArray output = (MWNumericArray)result.ToArray();
Console.WriteLine(output);
}
catch(Exception)
{
throw;
}
}
}
}
|
|
|
|
|
You can start by going into your project Properties and, on the Build tab, the Platform Target has to be x86, not AnyCPU.
|
|
|
|
|
I tried to change the platform target but it has no option except Active(Any CPU)
what to do now?
|
|
|
|
|
My problem is solved and now I got the result. Thanx
|
|
|
|
|
Some years ago I used to write code in Win32 API and there was a way for file mapping. I would like to know if there is file mapping technique in .net framework? If there is, how is it done? Thanks in advance.
|
|
|
|
|
Memory Mapped files were just added in 4.0 The class name is MemoryMappedFile but I have not used it.
|
|
|
|
|
Hello,
I wish to monitor bytes per second written or read from a directory.
Is something like this revealed by .NET framework, similar to that of FileSystemWatcher?
I am attempting to monitor I/O to the DfsrPrivate folder to better understand the I/O of the dfsr.exe process.
Thanks very much,
Matt
|
|
|
|
|
You can't monitor I/O speed based on a folder. The best you're going to get is to/from the entire disk or the I/O statistics for a process.
You'd use the PerformanceCounter[^] counter class and the appropriate performance counters to get the data you want.
|
|
|
|
|
My work around is to use process monitor by the sysinternals dudes. Then parse the data.
With the proper filters in place, the log ("backing file") grows about 4MB/minute; which is manageable.
Process Monitor has a feature called File Summary (http://www.pcmag.com/slideshow_viewer/0,3253,l%253D248743%2526a%253D248736%2526po%253D13,00.asp?p=n[^]) which will summarize exactly what I want.
Now, I guess the question is, how does Process Monitor gather this information? It's likely via the processes; monitoring the process's handles and where they are reading and writing.
For me, this method, using Process Monitor, will do. However, it would still be interesting to investigate further ways to actually ways to grab the handles and identify their I/O.
Thanks,
Matt
|
|
|
|
|
Process Monitor does it by sitting over the file system I/O functions. The technique is called API Hooking. PM hooks a lot of functions covering I/O, Registry, Process, ... It maintains a huge database that is populated with the API call data. It can give you all the details on a per-process basis quite easily.
|
|
|
|
|
http://www.codeproject.com/KB/cs/tictactoewin32.aspx
why this code can't run in c# visual studio 2008 ??
please answer , i need your helped thanks
|
|
|
|
|
It's customary, with articles, to just ask on the article forum itself. After all, the author is usually best placed to judge what's wrong. I appreciate though that this is an extremely old article, so there's a good chance you won't get an answer from the author.
In this case, the answer is extremely simple. This article is written for a version of .NET that isn't supported in VS2008. Back in 2002, .NET was at version 1, and the minimum version that VS2008 supports is 2. Saying that, you could create a new project in 2008 and then copy parts of the code in from this version, bearing in mind that .NET2 introduced lots of improvements to the language such as generics.
|
|
|
|
|
Is there a way in .Net to convert a given SQL data type to a .Net data type?
Everything makes sense in someone's mind
|
|
|
|
|
It depends. Perhaps you could be a little more specific
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Yes.
It's called casting[^]
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
Yes, there is a way. But unless you are more specific, it is difficult to get better answers.
|
|
|
|
|
|
|
The data adapter should already do this for standard types.
|
|
|
|
|
|
Hi all,
First some context to my question:
I am working on a utility that queries the Windows registry for a large number of keys set by a particular application.
I am using multiple DataGridView (DGV) controls to display the information (Reg Key and Value) on my form. Each DGV is tied to a Dictionary using a BindingSource.
This has worked out fine for all sets of keys except for one.
- This application has provision for 10 different user-profiles.
- Associated with each user-profile are 7 SETS of feature keys.
- At any given time, the user needs to see the settings for only ONE of the 10 profiles.
- On my form, I have a collection of radiobuttons that I use to select a profile.
PROBLEM:
1. Should I use an array of dictionaries (dimension 1: profile; dimension 2: feature)? If so, how do I do this? If not, what is a better solution?
2. Can I have only 1 set of DGVs (representing the feature keys), so when I click between profiles, the DGVs are updated with the values for that profile?
Thanks for your help!
|
|
|
|
|
0) The registry is evil, don't use it.
1) DataGridView is evil and likely an inappropriate control for your purpose.
2) The registry is a tree, why not use a TreeView?
|
|
|
|
|
PIEBALDconsult wrote: The registry is evil, don't use it.
Unfortunately, I have to
class="FQA">PIEBALDconsult wrote: 1) DataGridView is evil and likely an inappropriate control for your purpose.
Not sure why the DGV is so evil but it does work quite nicely for the purpose of my project.
PIEBALDconsult wrote: 2) The registry is a tree, why not use a TreeView?
I will look into using a TreeView... I did not know about this when I started working on my utility and I have the information displayed the way it is required. However, it might not be too late to rethink this design... thanks for the tip!
|
|
|
|
|
The keys you are looking up (for each dictionary) are just within one registry node, right? Otherwise the above advice is correct, you should use a control with tree capabilities.
A list of dictionaries is probably appropriate.
You can only have one set of controls, and switch their data sources when the profile changes.
|
|
|
|
|
BobJanova wrote: The keys you are looking up (for each dictionary) are just within one registry node, right? Otherwise the above advice is correct, you should use a control with tree capabilities.
Yes, they are.
BobJanova wrote:
A list of dictionaries is probably appropriate.
You can only have one set of controls, and switch their data sources when the profile changes.
Thank you! I will look into the list of dictionaries.
|
|
|
|