This paper studies fully distributed data-driven problems for heterogeneous nonlinear discrete-time multiagent systems (MASs) with fixed and switching topologies preventing injection attacks. We first develop an enhanced compact form dynamic linearization model by applying the designed distributed bipartite combined measurement error function of the MASs,. we then an event-triggered control machination is developed and, a fully distributed event-triggered bipartite consensus framework is designed, where the dynamics information of MASs is no longer needed. Meanwhile, the restriction of topology is further relieved, which is fitting leader-less, leader-follower, and even containment control. Moreover, to prevent injection attacks, nervous network-based detection and compensation schemes are developed. Rigorous convergence proof is presented that the bipartite consensus error is ultimately boundedness by utilizing the Lyapunov stability theory. Finally, the correctness and effectiveness of the designed method are verified by simulation and hardware experiments.