Generate input

Version 1.0.0.0 (1.29 KB) by Hamideh
I am trying to concatenate the numbers and create a vector of concat number with string format.
125 Downloads
Updated 5 Mar 2012

View License

%[data, text, alldata] = xlsread('C:\Users\hze1\Desktop\Descrete Choice Models\final_file_b.xls','Data','A1:GG25831');
data = [2 4;1 12;23 121];
s = size(data);
%FIPS = zeros(s(1),1);
filename0=('C:\Users\hze1\Desktop\Descrete Choice Models\FIPS.dat');
for i=1:s(1)
if length( num2str(data(i,1)))<2
temp1 = strcat('0', num2str(data(i,1)))
else
temp1 = num2str(data(i,1))
end

if length( num2str(data(i,2)))<2
temp2 = strcat('00', num2str(data(i,2)))
elseif length( num2str(data(i,2)))== 2
temp2 = strcat('0', num2str(data(i,2)))
else
temp2 = num2str(data(i,2))
end

FIPS{i} = strcat(temp1 , temp2)

end

%result should be : [02004;01012;23121]

%save (filename0, 'FIPS', '-dat');

Cite As

Hamideh (2026). Generate input (https://www.mathworks.com/matlabcentral/fileexchange/35470-generate-input), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Prepare Model Inputs and Outputs in Help Center and MATLAB Answers
Version Published Release Notes
1.0.0.0