# مباحث متفرقه برنامه نویسی > برنامه نویسی Matlab >  تبدیل عدد به رشته باینری در شبکه عصبی

## zahra.mf

سلام من یک شبکه عصبی طراحی کردم که لایه هدف (Target) یا خروجی که یه جدول با 6 تا ستون هست و اعدادش مقادیر بین 0 تا 3 هست . میخوام  مقاذیر داخل ستون ها رو به یک رشته باینری تبدیل بشه ولی نمیدونم کجا و چجوری باید این کار و بکنم
این کد من هست 
clear all;close all;
clc;


%%
load('Data.mat');
 load('Target.mat');


x = Data';
t = Target';






% Create a Fitting Network
hiddenLayerSize = 20;
TF={'compet','purelin'};
net = newff(x,t,hiddenLayerSize,TF);


% Choose Input and Output Pre/Post-Processing Functions
% For a list of all processing functions type: help nnprocess
net.input.processFcns = {'removeconstantrows','mapminmax'};
net.output.processFcns = {'removeconstantrows','mapminmax'};


% Setup Division of Data for Training, Validation, Testing
% For a list of all data division functions type: help nndivide
net.divideFcn = 'dividerand';  % Divide data randomly
net.divideMode = 'sample';  % Divide up every sample
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;




% For help on training function 'trainlm' type: help trainlm
% For a list of all training functions type: help nntrain
net.trainFcn = 'trainlm';  % Levenberg-Marquardt


% Choose a Performance Function
% For a list of all performance functions type: help nnperformance
net.performFcn = 'mse';  % Mean Squared Error


% Choose Plot Functions
% For a list of all plot functions type: help nnplot
net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ...
    'plotregression', 'plotfit'};
net.trainParam.max_fail=100;
net.trainParam.min_grad=1e-20;
net.trainParam.mu_max=1e+40;
net.trainParam.epochs=10000;


% Train the Network
[net,tr] = train(net,x,t);


% Test the Network
y = net(x);
e = gsubtract(t,y);
performance = perform(net,t,y)


% Recalculate Training, Validation and Test Performance
trainTargets = t .* tr.trainMask{1};
valTargets = t .* tr.valMask{1};
testTargets = t .* tr.testMask{1};
trainPerformance = perform(net,trainTargets,y)
valPerformance = perform(net,valTargets,y)
testPerformance = perform(net,testTargets,y)


% View the Network
view(net)

----------

