Hi all , i want to cast the output of fuzzy logic algorithm into any another type (float , int ,double..), i tried this with usual methods but there is no change..
This is the complete java code

public static void main(String[] args)throws Exception {
     String filename = "output.fcl";

        FIS fis = FIS.load(filename, true);
    if (fis == null) {
            System.err.println("Can't load file: '" + filename + "'");
            System.exit(1);
        }
// Show 
            FunctionBlock fb = fis.getFunctionBlock(null);

        // Set inputs
       fb.setVariable("input1", 3 );
        fb.setVariable("input2", 9.9);

        // Evaluate
        fb.evaluate();
JFuzzyChart.get().chart(fb);

        // Show output variable's chart
        Variable output = fb.getVariable("output");
        JFuzzyChart.get().chart(output, output.getDefuzzifier(), true);   

    }

I'm especially talking about this line:

  Variable output = fb.getVariable("output");

You are using classes that are not part of standard Java, and so we have no documentation for them.
In general you can't cast to a primitive type (int etc) because these are not classes. Only their corresponding classes (Integer etc) can be directly converted to primitives by Java ("unboxing").
Presumably the Variable class has methods to return its values as doubles or whatever - you will need to read the doc to find them.

ps: If you are using JFuzzyLogic, then the approriate method is called getValue()

Yes , it's working with this method

getValue()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.