User Tools

Site Tools


neurali:ispike_esempio1

Differences

This shows you the differences between two versions of the page.


Previous revision
neurali:ispike_esempio1 [2020/06/08 22:20] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +
 + come compilare:
 + g++ prova.cpp -lboost_system -liSpike
 +
 +compila senza errori,
 +
 +metto un file di testo "prova.txt" con questo contenuto (legge un solo valore alla volta dal file)
 +uno ogni ms.
 +
 +  54
 +
 +
 +<code c++>
 +#include <iostream>
 +#include <iSpike/Reader/FileAngleReader.hpp>
 +#include <iSpike/Channel/InputChannel/JointInputChannel.hpp>
 +#include <map>
 +
 +int main() 
 +{
 +
 +    std::cout << "prova";
 +    ispike::FileAngleReader* far = new ispike::FileAngleReader();
 +    map<string,ispike::Property> farp = far->getProperties();
 +    farp.at("File Name") = ispike::Property("prova.txt", "File Name", "description", true);
 +
 +    far->initialize(farp);
 +   
 +    ispike::JointInputChannel* jc = new ispike::JointInputChannel();
 +    map<string,ispike::Property> jcp = jc->getProperties();
 +    //jcp.at("minAngle") = ispike::Property(ispike::Property::Double, 10, "Minimum Angle", "description", true);
 +    jc->initialize(far, jcp);
 +
 +</code>
 +
 +output
 +
 +<code>
 +2015-Jul-22 23:12:59 Info: 0:      FileAngleReader: Reading angles from: prova.txt
 +2015-Jul-22 23:12:59 Info: 1:      FileAngleReader: Read the following angles: 54
 +2015-Jul-22 23:12:59 Debug: 2:     Initializing neuron simulator with 10 neurons.
 +
 +</code>
 +togliendo il commento alla riga in fondo si ottiene
 +
 +  terminate called after throwing an instance of 'std::out_of_range'
 +  what():  map::at
 +  Aborted
 +