how can i deploy my matlab GUI code m-file on theweb using matlab websrever and specifically display image results?
4 views (last 30 days)
Show older comments
i created a complex gui with a series of codes i got from the matlab central links below: 1)http://www.mathworks.com/matlabcentral/fileexchange/24369-wimax-physical-layer-simulation/all_files(for the deepwimaxmain) 2)802.16d system english version from matlab central site i created an html input page for the deepwimaxmain code in link(1) with the following inputs rate_id,G(cyclic prefix) and no(number of ofdm symbols)as well as all the other html pages as explained by matlab webserver manual.pdf but i keep getting some errors link 'non-finite end-points or increment for colon operator in index' and no figure is displayed even when i use simple examples.my deepwimax main m-file code for the matlab webserver is shown below function PageString = deepwimaxmain(InputSet, OutFile)
%------------------------------------------------------------ % Parse inputs from the page rate_id = str2double(InputSet.rate_id); G = str2double(InputSet.G); symbol_ofdm = str2double(InputSet.symbol_ofdm);
% Set directory path for storage of graphic files. cd(InputSet.mldir);
% Cleanup jpegs over an hour old. wscleanup('wsrml*.jpeg', 1);
% Check input arguments. if (nzmax(G)~=1) error('Please enter the value of the cyclic_prefix'); elseif ( spot <= 0 ) error('The cyclic_prefix must be positive'); end
if (nzmax(rate_id)>=7) error('Enter a rate_id valus between 0 al 6'); elseif ( rate_id <= 0 ) error('The rate_id must be positive'); end
if (nzmax(symbol_ofdm)~=1) error('Enter a number between 10 and 50'); elseif ( numsim <=0) error('The ofdm symbol must be a positive integer'); end
bit_error_rate=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; for q=1:no %%% data generation data_get =data_gen(rate_id); %%% data randomization data_rand=randomizer(data_get); %%% FEC ENCODER data_rscoded=rsencodecod(data_rand,rate_id,10); %%convolution encoder data_coded=convolution(data_rscoded,rate_id,10); %%% INTERLEAVING data_interleav=interleav_d(data_coded,rate_id); %%% Digital modulator SYMBOL MAPPER data_mod=mod_d(data_interleav,rate_id); %%% IFFT modulator data_tx=ofdmsymbol_fft_cp(data_mod,G,10);
SNR=[1 2 3 5 7 9 10 12 15 17 20 22 25 27 30]; % specify SNR for p=1:1:15 snr=SNR(p); %%% channel data_rx=channel_d(data_tx,snr); %%% FFT demodulator data_rxp=ofdmsymbol_fft_cp(data_rx,G,01); %%% Digital demodulator SYMBOL DEMEPPER data_demod=demod_d(data_rxp,rate_id); %%% DEINTERLEAVING data_deinterleav=deinterleav_d(data_demod,rate_id); % %%% FEC DECODER %% convolution decoder data_decoded=convolution(data_deinterleav,rate_id,01); %%% RSdecoder data_rsdecoded=rsencodecod(data_decoded,rate_id,01); % removing added tail bits %%% Data Derandomizer data_unrand=randomizer(data_rsdecoded); %% BER calculation [noerr(p),ber(p)] = biterr(data_unrand,data_get); end bit_error_rate=bit_error_rate+ber; end bit_error_rate=bit_error_rate/no %%plot the grapgh result=berplot(SNR,bit_error_rate,rate_id)
%------------------------------------------------------------ % Write the figure file %------------------------------------------------------------ %Render jpeg and write to file PlotFile = sprintf('result%s.jpeg', InputSet.mlid);
drawnow; wsprintjpeg(Fig, PlotFile); close(Fig);
templatefile = which('deepwimax2.html'); if ( exist('OutFile','var') == 1 ) % write Page to a diagnostic file s.GraphFileName = [ PlotFile]; PageString = htmlrep(s, templatefile, OutFile); else s.GraphFileName = ['/icons/' PlotFile]; PageString = htmlrep(s, templatefile); end
please can a matlab webserver expert help me to analyze and compare this code with the code found in link(1) and tell me where i have made mistakes?
0 Comments
Answers (1)
Hari
on 11 Jun 2025
Hi,
I understand that you're integrating a MATLAB-based WiMAX simulation with a web interface and are encountering runtime issues such as invalid index errors and no figures being displayed.
I assume the goal is to let users input parameters like modulation rate, cyclic prefix, and number of OFDM symbols through HTML, and use those inputs to run the deepwimaxmain simulation while displaying BER results graphically.
In order to troubleshoot and resolve the errors, you can follow the below steps:
Step 1: Verify and validate user inputs
Ensure the inputs (rate_id, G, and number of OFDM symbols) are properly read and converted to numerical values. Any missing or invalid (e.g., NaN, negative) values should be handled before proceeding with calculations.
Step 2: Correct all undefined variables
Check your input condition blocks. Variables like spot and numsim are used without being defined or assigned, which will lead to runtime errors. Make sure that you're using consistently named and initialized variables for all input checks.
Step 3: Allocate and manage variables properly
Make sure arrays used inside loops, such as for BER and error counting, are correctly sized before use. Avoid using mismatched or dynamically growing arrays, which can lead to indexing errors.
Step 4: Properly handle figure creation and file saving
The plotting section needs an explicit figure handle. Without that, functions that save or export the plot (like JPEG output) won't work as expected. Also confirm that the file-saving path exists and is writable by the web server.
Step 5: Ensure the HTML template is compatible
The HTML file you're using to display results should correctly reference the plot image. Double-check that the placeholder for the image file path is correctly defined and replaced with the generated filename in your MATLAB code.
References:
Hope this helps!
0 Comments
See Also
Categories
Find more on MATLAB Compiler SDK in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!