Tag Archives: matlab
Know if Serialport is connected (in App Designer program); ishandle() always true
I open a serial port to my Arduino and it usually works. I’m trying to take care of various errors, for one of which I need to know if the port handle is there and connected or not. In Command window I can tell when ishandle(MyCom) returns a logical answer
ishandle(app.PicoCom)
ans =
0×0 empty logical array
But programatically determining if it’s there, say with
ishandle(app.PicoCom) == false
ans =
0×0 empty logical array
Doesn’t work, it’s always true. How do I ask a false logical array if it’s false and why does this have to be so hard? Does anybody really need an array response to ishandle(app.PicoCom)? if ~ishandle(app.PicoCom) should be enough.
I also tried if ~exist(…) and even isstr(app.PicoCom.Port) but they don’t work when it’s not a handle.
BTW, ishandle() is only described as for graphic objects and figures and the existing answer doesn’t answer my question
https://www.mathworks.com/matlabcentral/answers/13424-why-does-ishandle-0-return-1?s_tid=srchtitleI open a serial port to my Arduino and it usually works. I’m trying to take care of various errors, for one of which I need to know if the port handle is there and connected or not. In Command window I can tell when ishandle(MyCom) returns a logical answer
ishandle(app.PicoCom)
ans =
0×0 empty logical array
But programatically determining if it’s there, say with
ishandle(app.PicoCom) == false
ans =
0×0 empty logical array
Doesn’t work, it’s always true. How do I ask a false logical array if it’s false and why does this have to be so hard? Does anybody really need an array response to ishandle(app.PicoCom)? if ~ishandle(app.PicoCom) should be enough.
I also tried if ~exist(…) and even isstr(app.PicoCom.Port) but they don’t work when it’s not a handle.
BTW, ishandle() is only described as for graphic objects and figures and the existing answer doesn’t answer my question
https://www.mathworks.com/matlabcentral/answers/13424-why-does-ishandle-0-return-1?s_tid=srchtitle I open a serial port to my Arduino and it usually works. I’m trying to take care of various errors, for one of which I need to know if the port handle is there and connected or not. In Command window I can tell when ishandle(MyCom) returns a logical answer
ishandle(app.PicoCom)
ans =
0×0 empty logical array
But programatically determining if it’s there, say with
ishandle(app.PicoCom) == false
ans =
0×0 empty logical array
Doesn’t work, it’s always true. How do I ask a false logical array if it’s false and why does this have to be so hard? Does anybody really need an array response to ishandle(app.PicoCom)? if ~ishandle(app.PicoCom) should be enough.
I also tried if ~exist(…) and even isstr(app.PicoCom.Port) but they don’t work when it’s not a handle.
BTW, ishandle() is only described as for graphic objects and figures and the existing answer doesn’t answer my question
https://www.mathworks.com/matlabcentral/answers/13424-why-does-ishandle-0-return-1?s_tid=srchtitle ishandle is true when its false MATLAB Answers — New Questions
Wireless connection to PI4 Bullseye ad-hoc mode
We have sucessfully programmed our application to run python scripts on a Pi4 when it is connected to our network via the ethernet lan connection.
We need to go to the next phase where the comptuer connects wirelessly to the PI without a network present. Matlab indicated that this was possible when we reviewed the project during the software decision proesses.
We think we need to turn the PI into a server, however we are not finding a resource with a working link that actually accomplishes this task. Any guidance or direction to links that are known to work would be greatly appreciated.
Hardware Pi4B
PI OS – bullseye
Matlab 2024aWe have sucessfully programmed our application to run python scripts on a Pi4 when it is connected to our network via the ethernet lan connection.
We need to go to the next phase where the comptuer connects wirelessly to the PI without a network present. Matlab indicated that this was possible when we reviewed the project during the software decision proesses.
We think we need to turn the PI into a server, however we are not finding a resource with a working link that actually accomplishes this task. Any guidance or direction to links that are known to work would be greatly appreciated.
Hardware Pi4B
PI OS – bullseye
Matlab 2024a We have sucessfully programmed our application to run python scripts on a Pi4 when it is connected to our network via the ethernet lan connection.
We need to go to the next phase where the comptuer connects wirelessly to the PI without a network present. Matlab indicated that this was possible when we reviewed the project during the software decision proesses.
We think we need to turn the PI into a server, however we are not finding a resource with a working link that actually accomplishes this task. Any guidance or direction to links that are known to work would be greatly appreciated.
Hardware Pi4B
PI OS – bullseye
Matlab 2024a ad-hoc, pi4, bullseye MATLAB Answers — New Questions
Using Shortcuts in MATLAB
Hello Everyone , I am a VS Code user and new to MATLAB , I have many extensions in VS Code which makes my work easier and effortless
I feel that MATLAB is missing some of these features. for example , in VS Code, I frequently use Shift + Alt + Down Arrow or Up Arrow to duplicate lines, but I couldn’t find a similar command in the MATLAB documentation.
I also use several commands repetitively. Is there a way to create shortcuts for these commands in MATLAB? Additionally, I’d like to know if it’s possible to customize these shortcuts, as I am accustomed to different keybindings, and MATLAB’s default shortcuts are not quite what I’m used to.
I am using windows , Could someone please assist me with this?Hello Everyone , I am a VS Code user and new to MATLAB , I have many extensions in VS Code which makes my work easier and effortless
I feel that MATLAB is missing some of these features. for example , in VS Code, I frequently use Shift + Alt + Down Arrow or Up Arrow to duplicate lines, but I couldn’t find a similar command in the MATLAB documentation.
I also use several commands repetitively. Is there a way to create shortcuts for these commands in MATLAB? Additionally, I’d like to know if it’s possible to customize these shortcuts, as I am accustomed to different keybindings, and MATLAB’s default shortcuts are not quite what I’m used to.
I am using windows , Could someone please assist me with this? Hello Everyone , I am a VS Code user and new to MATLAB , I have many extensions in VS Code which makes my work easier and effortless
I feel that MATLAB is missing some of these features. for example , in VS Code, I frequently use Shift + Alt + Down Arrow or Up Arrow to duplicate lines, but I couldn’t find a similar command in the MATLAB documentation.
I also use several commands repetitively. Is there a way to create shortcuts for these commands in MATLAB? Additionally, I’d like to know if it’s possible to customize these shortcuts, as I am accustomed to different keybindings, and MATLAB’s default shortcuts are not quite what I’m used to.
I am using windows , Could someone please assist me with this? matlab, shortcuts MATLAB Answers — New Questions
Can Anyone help me to solve this error?Error using * Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use ‘.
here’s the full code
numAntennasTx = 256; % Number of antennasTx
numAntennasRx = 16; % Number of antennasRx
numBits = 10000000; % Number of random bits
ModulationOrder = 16; % 16QAM
snrValues = 0:5:40; % Range of SNR values
%% Generate Random Bits
bits = randi([0 1], numBits, 1);
%% Convolutional Encoding
trellis = poly2trellis(7, [171 133]); % Example trellis
codedBits = convenc(bits, trellis);
%% Modulation
mod_symbols = qammod(codedBits, ModulationOrder, ‘InputType’, ‘bit’, ‘UnitAveragePower’, true);
%% Ensure the number of symbols can be reshaped properly
numSymbols = length(mod_symbols);
paddingSymbols = mod(numAntennasTx – mod(numSymbols, numAntennasTx), numAntennasTx);
mod_symbols_padded = [mod_symbols; zeros(paddingSymbols, 1)];
%% Reshape modulated symbols to fit Tx antennas
mod_symbols_reshaped = reshape(mod_symbols_padded, numAntennasTx, []);
%% Precoding
H = (randn(numAntennasRx, numAntennasTx) + 1i * randn(numAntennasRx, numAntennasTx)) / sqrt(2*numAntennasRx); % Channel matrix
% Regularized Zero Forcing (RZF) Precoding
lambda = 0.01; % Regularization parameter
WRZF = (H’ / (H*H’ + lambda*eye(numAntennasRx)));
% Phased Zero Forcing (PZF) Precoding
angle_H = angle(H);
phase_shift = exp(-1i*angle_H);
H_pzf = H .* phase_shift;
WPZF = (H_pzf’ / (H_pzf*H_pzf’));
%% Apply Precoding
size(WRZF)
size(mod_symbols_reshaped)
precodedBitsRZF = WRZF * mod_symbols_reshaped; % precoding RZF
precodedBitsPZF = WPZF * mod_symbols_reshaped; % precoding PZF
%% Without Precoding
precodedBitsWP = mod_symbols_reshaped; % No precoding
%% OFDM Modulation with Precoding
OfdmSymbolsRZF = ifft(precodedBitsRZF, [], 2); % OFDM modulation with RZF precoding
OfdmSymbolsPZF = ifft(precodedBitsPZF, [], 2); % OFDM modulation with PZF precoding
OfdmSymbolsWP = ifft(precodedBitsWP, [], 2); % OFDM modulation without precoding
%% Channel AWGN
berRZF = zeros(1, length(snrValues)); % Initialize BER results for RZF
berPZF = zeros(1, length(snrValues)); % Initialize BER results for PZF
berWP = zeros(1, length(snrValues)); % Initialize BER results for no precoding
for i = 1:length(snrValues)
snr = snrValues(i);
noiseVar = 1 / (10^(snr/10));
% Transmit through channel (AWGN) for RZF
rxSymbolsRZF = awgn(H * OfdmSymbolsRZF, snr, ‘measured’) + sqrt(noiseVar/2) * (randn(size(OfdmSymbolsRZF)) + 1i * randn(size(OfdmSymbolsRZF)));
% Transmit through channel (AWGN) for PZF
rxSymbolsPZF = awgn(H * OfdmSymbolsPZF, snr, ‘measured’) + sqrt(noiseVar/2) * (randn(size(OfdmSymbolsPZF)) + 1i * randn(size(OfdmSymbolsPZF)));
% Transmit through channel (AWGN) without precoding
rxSymbolsWP = awgn(H * OfdmSymbolsWP, snr, ‘measured’) + sqrt(noiseVar/2) * (randn(size(OfdmSymbolsWP)) + 1i * randn(size(OfdmSymbolsWP)));
%% OFDM Demodulation
% Serial to Parallel Conversion
receivedSymbolsRZFSerial = reshape(rxSymbolsRZF, [], numAntennasRx).’; % Serial to parallel conversion
receivedSymbolsPZFSerial = reshape(rxSymbolsPZF, [], numAntennasRx).’; % Serial to parallel conversion
receivedSymbolsWPSerial = reshape(rxSymbolsWP, [], numAntennasRx).’; % Serial to parallel conversion
% Perform OFDM demodulation for RZF
rxSymbolsIFFTRZF = fft(receivedSymbolsRZFSerial, [], 2); % FFT
% Perform OFDM demodulation for PZF
rxSymbolsIFFTPZF = fft(receivedSymbolsPZFSerial, [], 2); % FFT
% Perform OFDM demodulation for no precoding
rxSymbolsIFFTWP = fft(receivedSymbolsWPSerial, [], 2); % FFT
%% Parallel to Serial Conversion
rxSymbolsDemod_RZF = reshape(rxSymbolsIFFTRZF.’, [], 1); % Parallel to serial conversion
rxSymbolsDemod_PZF = reshape(rxSymbolsIFFTPZF.’, [], 1); % Parallel to serial conversion
rxSymbolsDemod_WP = reshape(rxSymbolsIFFTWP.’, [], 1); % Parallel to serial conversion
% Remove the padded symbols before demodulation
rxSymbolsDemod_RZF = rxSymbolsDemod_RZF(1:end-paddingSymbols);
rxSymbolsDemod_PZF = rxSymbolsDemod_PZF(1:end-paddingSymbols);
rxSymbolsDemod_WP = rxSymbolsDemod_WP(1:end-paddingSymbols);
% QAM demodulation
demodBitsRZF = qamdemod(rxSymbolsDemod_RZF, ModulationOrder, ‘OutputType’, ‘bit’, ‘UnitAveragePower’, true);
demodBitsPZF = qamdemod(rxSymbolsDemod_PZF, ModulationOrder, ‘OutputType’, ‘bit’, ‘UnitAveragePower’, true);
demodBitsWP = qamdemod(rxSymbolsDemod_WP, ModulationOrder, ‘OutputType’, ‘bit’, ‘UnitAveragePower’, true);
% Calculate the Bit Error Rate (BER)
berRZF(i) = sum(demodBitsRZF ~= codedBits(1:end-paddingSymbols)) / numBits;
berPZF(i) = sum(demodBitsPZF ~= codedBits(1:end-paddingSymbols)) / numBits;
berWP(i) = sum(demodBitsWP ~= codedBits(1:end-paddingSymbols)) / numBits;
end
%% Display Results
fprintf(‘Bit Error Rate (RZF Precoding):n’);
disp(berRZF);
fprintf(‘Bit Error Rate (PZF Precoding):n’);
disp(berPZF);
fprintf(‘Bit Error Rate (Without Precoding):n’);
disp(berWP);
%% Plotting the results
figure;
semilogy(snrValues, berRZF, ‘bs-‘, ‘LineWidth’, 2);
hold on;
semilogy(snrValues, berPZF, ‘gs-‘, ‘LineWidth’, 2);
semilogy(snrValues, berWP, ‘rs-‘, ‘LineWidth’, 2);
xlabel(‘SNR (dB)’);
ylabel(‘Bit Error Rate (BER)’);
legend(‘RZF Precoding’, ‘PZF Precoding’, ‘Without Precoding’);
title(‘Massive MIMO 256×16 Antennas with RZF and PZF Precoding’);
grid on;here’s the full code
numAntennasTx = 256; % Number of antennasTx
numAntennasRx = 16; % Number of antennasRx
numBits = 10000000; % Number of random bits
ModulationOrder = 16; % 16QAM
snrValues = 0:5:40; % Range of SNR values
%% Generate Random Bits
bits = randi([0 1], numBits, 1);
%% Convolutional Encoding
trellis = poly2trellis(7, [171 133]); % Example trellis
codedBits = convenc(bits, trellis);
%% Modulation
mod_symbols = qammod(codedBits, ModulationOrder, ‘InputType’, ‘bit’, ‘UnitAveragePower’, true);
%% Ensure the number of symbols can be reshaped properly
numSymbols = length(mod_symbols);
paddingSymbols = mod(numAntennasTx – mod(numSymbols, numAntennasTx), numAntennasTx);
mod_symbols_padded = [mod_symbols; zeros(paddingSymbols, 1)];
%% Reshape modulated symbols to fit Tx antennas
mod_symbols_reshaped = reshape(mod_symbols_padded, numAntennasTx, []);
%% Precoding
H = (randn(numAntennasRx, numAntennasTx) + 1i * randn(numAntennasRx, numAntennasTx)) / sqrt(2*numAntennasRx); % Channel matrix
% Regularized Zero Forcing (RZF) Precoding
lambda = 0.01; % Regularization parameter
WRZF = (H’ / (H*H’ + lambda*eye(numAntennasRx)));
% Phased Zero Forcing (PZF) Precoding
angle_H = angle(H);
phase_shift = exp(-1i*angle_H);
H_pzf = H .* phase_shift;
WPZF = (H_pzf’ / (H_pzf*H_pzf’));
%% Apply Precoding
size(WRZF)
size(mod_symbols_reshaped)
precodedBitsRZF = WRZF * mod_symbols_reshaped; % precoding RZF
precodedBitsPZF = WPZF * mod_symbols_reshaped; % precoding PZF
%% Without Precoding
precodedBitsWP = mod_symbols_reshaped; % No precoding
%% OFDM Modulation with Precoding
OfdmSymbolsRZF = ifft(precodedBitsRZF, [], 2); % OFDM modulation with RZF precoding
OfdmSymbolsPZF = ifft(precodedBitsPZF, [], 2); % OFDM modulation with PZF precoding
OfdmSymbolsWP = ifft(precodedBitsWP, [], 2); % OFDM modulation without precoding
%% Channel AWGN
berRZF = zeros(1, length(snrValues)); % Initialize BER results for RZF
berPZF = zeros(1, length(snrValues)); % Initialize BER results for PZF
berWP = zeros(1, length(snrValues)); % Initialize BER results for no precoding
for i = 1:length(snrValues)
snr = snrValues(i);
noiseVar = 1 / (10^(snr/10));
% Transmit through channel (AWGN) for RZF
rxSymbolsRZF = awgn(H * OfdmSymbolsRZF, snr, ‘measured’) + sqrt(noiseVar/2) * (randn(size(OfdmSymbolsRZF)) + 1i * randn(size(OfdmSymbolsRZF)));
% Transmit through channel (AWGN) for PZF
rxSymbolsPZF = awgn(H * OfdmSymbolsPZF, snr, ‘measured’) + sqrt(noiseVar/2) * (randn(size(OfdmSymbolsPZF)) + 1i * randn(size(OfdmSymbolsPZF)));
% Transmit through channel (AWGN) without precoding
rxSymbolsWP = awgn(H * OfdmSymbolsWP, snr, ‘measured’) + sqrt(noiseVar/2) * (randn(size(OfdmSymbolsWP)) + 1i * randn(size(OfdmSymbolsWP)));
%% OFDM Demodulation
% Serial to Parallel Conversion
receivedSymbolsRZFSerial = reshape(rxSymbolsRZF, [], numAntennasRx).’; % Serial to parallel conversion
receivedSymbolsPZFSerial = reshape(rxSymbolsPZF, [], numAntennasRx).’; % Serial to parallel conversion
receivedSymbolsWPSerial = reshape(rxSymbolsWP, [], numAntennasRx).’; % Serial to parallel conversion
% Perform OFDM demodulation for RZF
rxSymbolsIFFTRZF = fft(receivedSymbolsRZFSerial, [], 2); % FFT
% Perform OFDM demodulation for PZF
rxSymbolsIFFTPZF = fft(receivedSymbolsPZFSerial, [], 2); % FFT
% Perform OFDM demodulation for no precoding
rxSymbolsIFFTWP = fft(receivedSymbolsWPSerial, [], 2); % FFT
%% Parallel to Serial Conversion
rxSymbolsDemod_RZF = reshape(rxSymbolsIFFTRZF.’, [], 1); % Parallel to serial conversion
rxSymbolsDemod_PZF = reshape(rxSymbolsIFFTPZF.’, [], 1); % Parallel to serial conversion
rxSymbolsDemod_WP = reshape(rxSymbolsIFFTWP.’, [], 1); % Parallel to serial conversion
% Remove the padded symbols before demodulation
rxSymbolsDemod_RZF = rxSymbolsDemod_RZF(1:end-paddingSymbols);
rxSymbolsDemod_PZF = rxSymbolsDemod_PZF(1:end-paddingSymbols);
rxSymbolsDemod_WP = rxSymbolsDemod_WP(1:end-paddingSymbols);
% QAM demodulation
demodBitsRZF = qamdemod(rxSymbolsDemod_RZF, ModulationOrder, ‘OutputType’, ‘bit’, ‘UnitAveragePower’, true);
demodBitsPZF = qamdemod(rxSymbolsDemod_PZF, ModulationOrder, ‘OutputType’, ‘bit’, ‘UnitAveragePower’, true);
demodBitsWP = qamdemod(rxSymbolsDemod_WP, ModulationOrder, ‘OutputType’, ‘bit’, ‘UnitAveragePower’, true);
% Calculate the Bit Error Rate (BER)
berRZF(i) = sum(demodBitsRZF ~= codedBits(1:end-paddingSymbols)) / numBits;
berPZF(i) = sum(demodBitsPZF ~= codedBits(1:end-paddingSymbols)) / numBits;
berWP(i) = sum(demodBitsWP ~= codedBits(1:end-paddingSymbols)) / numBits;
end
%% Display Results
fprintf(‘Bit Error Rate (RZF Precoding):n’);
disp(berRZF);
fprintf(‘Bit Error Rate (PZF Precoding):n’);
disp(berPZF);
fprintf(‘Bit Error Rate (Without Precoding):n’);
disp(berWP);
%% Plotting the results
figure;
semilogy(snrValues, berRZF, ‘bs-‘, ‘LineWidth’, 2);
hold on;
semilogy(snrValues, berPZF, ‘gs-‘, ‘LineWidth’, 2);
semilogy(snrValues, berWP, ‘rs-‘, ‘LineWidth’, 2);
xlabel(‘SNR (dB)’);
ylabel(‘Bit Error Rate (BER)’);
legend(‘RZF Precoding’, ‘PZF Precoding’, ‘Without Precoding’);
title(‘Massive MIMO 256×16 Antennas with RZF and PZF Precoding’);
grid on; here’s the full code
numAntennasTx = 256; % Number of antennasTx
numAntennasRx = 16; % Number of antennasRx
numBits = 10000000; % Number of random bits
ModulationOrder = 16; % 16QAM
snrValues = 0:5:40; % Range of SNR values
%% Generate Random Bits
bits = randi([0 1], numBits, 1);
%% Convolutional Encoding
trellis = poly2trellis(7, [171 133]); % Example trellis
codedBits = convenc(bits, trellis);
%% Modulation
mod_symbols = qammod(codedBits, ModulationOrder, ‘InputType’, ‘bit’, ‘UnitAveragePower’, true);
%% Ensure the number of symbols can be reshaped properly
numSymbols = length(mod_symbols);
paddingSymbols = mod(numAntennasTx – mod(numSymbols, numAntennasTx), numAntennasTx);
mod_symbols_padded = [mod_symbols; zeros(paddingSymbols, 1)];
%% Reshape modulated symbols to fit Tx antennas
mod_symbols_reshaped = reshape(mod_symbols_padded, numAntennasTx, []);
%% Precoding
H = (randn(numAntennasRx, numAntennasTx) + 1i * randn(numAntennasRx, numAntennasTx)) / sqrt(2*numAntennasRx); % Channel matrix
% Regularized Zero Forcing (RZF) Precoding
lambda = 0.01; % Regularization parameter
WRZF = (H’ / (H*H’ + lambda*eye(numAntennasRx)));
% Phased Zero Forcing (PZF) Precoding
angle_H = angle(H);
phase_shift = exp(-1i*angle_H);
H_pzf = H .* phase_shift;
WPZF = (H_pzf’ / (H_pzf*H_pzf’));
%% Apply Precoding
size(WRZF)
size(mod_symbols_reshaped)
precodedBitsRZF = WRZF * mod_symbols_reshaped; % precoding RZF
precodedBitsPZF = WPZF * mod_symbols_reshaped; % precoding PZF
%% Without Precoding
precodedBitsWP = mod_symbols_reshaped; % No precoding
%% OFDM Modulation with Precoding
OfdmSymbolsRZF = ifft(precodedBitsRZF, [], 2); % OFDM modulation with RZF precoding
OfdmSymbolsPZF = ifft(precodedBitsPZF, [], 2); % OFDM modulation with PZF precoding
OfdmSymbolsWP = ifft(precodedBitsWP, [], 2); % OFDM modulation without precoding
%% Channel AWGN
berRZF = zeros(1, length(snrValues)); % Initialize BER results for RZF
berPZF = zeros(1, length(snrValues)); % Initialize BER results for PZF
berWP = zeros(1, length(snrValues)); % Initialize BER results for no precoding
for i = 1:length(snrValues)
snr = snrValues(i);
noiseVar = 1 / (10^(snr/10));
% Transmit through channel (AWGN) for RZF
rxSymbolsRZF = awgn(H * OfdmSymbolsRZF, snr, ‘measured’) + sqrt(noiseVar/2) * (randn(size(OfdmSymbolsRZF)) + 1i * randn(size(OfdmSymbolsRZF)));
% Transmit through channel (AWGN) for PZF
rxSymbolsPZF = awgn(H * OfdmSymbolsPZF, snr, ‘measured’) + sqrt(noiseVar/2) * (randn(size(OfdmSymbolsPZF)) + 1i * randn(size(OfdmSymbolsPZF)));
% Transmit through channel (AWGN) without precoding
rxSymbolsWP = awgn(H * OfdmSymbolsWP, snr, ‘measured’) + sqrt(noiseVar/2) * (randn(size(OfdmSymbolsWP)) + 1i * randn(size(OfdmSymbolsWP)));
%% OFDM Demodulation
% Serial to Parallel Conversion
receivedSymbolsRZFSerial = reshape(rxSymbolsRZF, [], numAntennasRx).’; % Serial to parallel conversion
receivedSymbolsPZFSerial = reshape(rxSymbolsPZF, [], numAntennasRx).’; % Serial to parallel conversion
receivedSymbolsWPSerial = reshape(rxSymbolsWP, [], numAntennasRx).’; % Serial to parallel conversion
% Perform OFDM demodulation for RZF
rxSymbolsIFFTRZF = fft(receivedSymbolsRZFSerial, [], 2); % FFT
% Perform OFDM demodulation for PZF
rxSymbolsIFFTPZF = fft(receivedSymbolsPZFSerial, [], 2); % FFT
% Perform OFDM demodulation for no precoding
rxSymbolsIFFTWP = fft(receivedSymbolsWPSerial, [], 2); % FFT
%% Parallel to Serial Conversion
rxSymbolsDemod_RZF = reshape(rxSymbolsIFFTRZF.’, [], 1); % Parallel to serial conversion
rxSymbolsDemod_PZF = reshape(rxSymbolsIFFTPZF.’, [], 1); % Parallel to serial conversion
rxSymbolsDemod_WP = reshape(rxSymbolsIFFTWP.’, [], 1); % Parallel to serial conversion
% Remove the padded symbols before demodulation
rxSymbolsDemod_RZF = rxSymbolsDemod_RZF(1:end-paddingSymbols);
rxSymbolsDemod_PZF = rxSymbolsDemod_PZF(1:end-paddingSymbols);
rxSymbolsDemod_WP = rxSymbolsDemod_WP(1:end-paddingSymbols);
% QAM demodulation
demodBitsRZF = qamdemod(rxSymbolsDemod_RZF, ModulationOrder, ‘OutputType’, ‘bit’, ‘UnitAveragePower’, true);
demodBitsPZF = qamdemod(rxSymbolsDemod_PZF, ModulationOrder, ‘OutputType’, ‘bit’, ‘UnitAveragePower’, true);
demodBitsWP = qamdemod(rxSymbolsDemod_WP, ModulationOrder, ‘OutputType’, ‘bit’, ‘UnitAveragePower’, true);
% Calculate the Bit Error Rate (BER)
berRZF(i) = sum(demodBitsRZF ~= codedBits(1:end-paddingSymbols)) / numBits;
berPZF(i) = sum(demodBitsPZF ~= codedBits(1:end-paddingSymbols)) / numBits;
berWP(i) = sum(demodBitsWP ~= codedBits(1:end-paddingSymbols)) / numBits;
end
%% Display Results
fprintf(‘Bit Error Rate (RZF Precoding):n’);
disp(berRZF);
fprintf(‘Bit Error Rate (PZF Precoding):n’);
disp(berPZF);
fprintf(‘Bit Error Rate (Without Precoding):n’);
disp(berWP);
%% Plotting the results
figure;
semilogy(snrValues, berRZF, ‘bs-‘, ‘LineWidth’, 2);
hold on;
semilogy(snrValues, berPZF, ‘gs-‘, ‘LineWidth’, 2);
semilogy(snrValues, berWP, ‘rs-‘, ‘LineWidth’, 2);
xlabel(‘SNR (dB)’);
ylabel(‘Bit Error Rate (BER)’);
legend(‘RZF Precoding’, ‘PZF Precoding’, ‘Without Precoding’);
title(‘Massive MIMO 256×16 Antennas with RZF and PZF Precoding’);
grid on; transferred MATLAB Answers — New Questions
Determining gait cycle from heel marker motion capture data
I have motion capture data of participants walking, jogging and running on a treadmill. Participants had a marker on each heel. I need to determine each gait cycle from this data so that I can then calculate breast range of motion, velocity and acceleration for each gait cycle.I have motion capture data of participants walking, jogging and running on a treadmill. Participants had a marker on each heel. I need to determine each gait cycle from this data so that I can then calculate breast range of motion, velocity and acceleration for each gait cycle. I have motion capture data of participants walking, jogging and running on a treadmill. Participants had a marker on each heel. I need to determine each gait cycle from this data so that I can then calculate breast range of motion, velocity and acceleration for each gait cycle. gait cycle determination, motion capture MATLAB Answers — New Questions
How do you use a one parameter (S11), (s1p extension) file to model a direct RF chip input in RF Budget analyzer.
I’m trying to model the TI AFE7906 and have some one port S11 input reflection files provided that describe the input behaviour of the receive ports. How can these files be entered in the RF Budget Analyer (in the "S-Parameters" element) to do this? I realize the app is looking for a two port file for it’s cascade analysis but I need to model the Rx input at the end of the RF chain.I’m trying to model the TI AFE7906 and have some one port S11 input reflection files provided that describe the input behaviour of the receive ports. How can these files be entered in the RF Budget Analyer (in the "S-Parameters" element) to do this? I realize the app is looking for a two port file for it’s cascade analysis but I need to model the Rx input at the end of the RF chain. I’m trying to model the TI AFE7906 and have some one port S11 input reflection files provided that describe the input behaviour of the receive ports. How can these files be entered in the RF Budget Analyer (in the "S-Parameters" element) to do this? I realize the app is looking for a two port file for it’s cascade analysis but I need to model the Rx input at the end of the RF chain. s1p file MATLAB Answers — New Questions
trying to call a function from a function file in a script file
func = afunction; %trying to make the variable func equivalent to "afunciton",
% the function I created in the afunction file but it doesn’t work 🙁
llim = -5;
ulim = -1;
options = optimset(‘Display’,’iter’,’TolX’,10^-7,’Maxiter’,500);
[x] = fzero(@func, [llim ulim],options);
I have a seperate function file called afunction that has the function afunction (which just has like a f(x)= … function in it), but when I try to run this code the error says "Execution of script afunction as a function is not supported:
/Users/my name/Documents/MATLAB/afunction.m" in line 2func = afunction; %trying to make the variable func equivalent to "afunciton",
% the function I created in the afunction file but it doesn’t work 🙁
llim = -5;
ulim = -1;
options = optimset(‘Display’,’iter’,’TolX’,10^-7,’Maxiter’,500);
[x] = fzero(@func, [llim ulim],options);
I have a seperate function file called afunction that has the function afunction (which just has like a f(x)= … function in it), but when I try to run this code the error says "Execution of script afunction as a function is not supported:
/Users/my name/Documents/MATLAB/afunction.m" in line 2 func = afunction; %trying to make the variable func equivalent to "afunciton",
% the function I created in the afunction file but it doesn’t work 🙁
llim = -5;
ulim = -1;
options = optimset(‘Display’,’iter’,’TolX’,10^-7,’Maxiter’,500);
[x] = fzero(@func, [llim ulim],options);
I have a seperate function file called afunction that has the function afunction (which just has like a f(x)= … function in it), but when I try to run this code the error says "Execution of script afunction as a function is not supported:
/Users/my name/Documents/MATLAB/afunction.m" in line 2 function call MATLAB Answers — New Questions
Numerical integration of area
Hi,
I know this must be so easy but I’m confused. I have a section such as this:
I have both variables depth and distance as vectors:
>> whos depth rotx
Name Size Bytes Class Attributes
depth 69×1 552 double
rotx 69×1 552 double
What is the right way to compute the section area?
Thanks!Hi,
I know this must be so easy but I’m confused. I have a section such as this:
I have both variables depth and distance as vectors:
>> whos depth rotx
Name Size Bytes Class Attributes
depth 69×1 552 double
rotx 69×1 552 double
What is the right way to compute the section area?
Thanks! Hi,
I know this must be so easy but I’m confused. I have a section such as this:
I have both variables depth and distance as vectors:
>> whos depth rotx
Name Size Bytes Class Attributes
depth 69×1 552 double
rotx 69×1 552 double
What is the right way to compute the section area?
Thanks! numerical integration MATLAB Answers — New Questions
How to resolve the error ‘The installed MATLAB Runtime is not compatible with the application’ when executing a standalone application?
I get the following error when executing a standalone application that was created with MATLAB Compiler:
The installed MATLAB Runtime is not compatible with the application. Reinstall
the MATLAB Runtime or the application using the application installer
generated using deploytool.I get the following error when executing a standalone application that was created with MATLAB Compiler:
The installed MATLAB Runtime is not compatible with the application. Reinstall
the MATLAB Runtime or the application using the application installer
generated using deploytool. I get the following error when executing a standalone application that was created with MATLAB Compiler:
The installed MATLAB Runtime is not compatible with the application. Reinstall
the MATLAB Runtime or the application using the application installer
generated using deploytool. MATLAB Answers — New Questions
Trying to update submodules of a project with a script.
Hello,
I’m trying to create a script to facilitate team member when they have to update submodules inside a project to a specific tag.
I have no problem for the upadate, but io’m quite stuck to the commit phase.
I try this list of commands:
commit_message = char(strcat("Moved submodule Standard to ", standard_tag, {newline}, "Moved submodule Common to ", common_tag));
git_command = [‘git commit -m ‘ commit_message];
system(git_command);
but, when i try to execute the script, i have this errors:
error: pathspec ‘submodule’ did not match any file(s) known to git
error: pathspec ‘Standard’ did not match any file(s) known to git
error: pathspec ‘to’ did not match any file(s) known to git
error: pathspec ‘2024R2’ did not match any file(s) known to git
I suppose that my issue is related to this:
git_command = ‘git commit -m Moved submodule Standard to 2024R2
Moved submodule Common to 2024R2′
It seems that the system function can’t isolate correctly the "message" for the commit. How can i solve this one.
Thank you in advance.
Best regards.
ClaudioHello,
I’m trying to create a script to facilitate team member when they have to update submodules inside a project to a specific tag.
I have no problem for the upadate, but io’m quite stuck to the commit phase.
I try this list of commands:
commit_message = char(strcat("Moved submodule Standard to ", standard_tag, {newline}, "Moved submodule Common to ", common_tag));
git_command = [‘git commit -m ‘ commit_message];
system(git_command);
but, when i try to execute the script, i have this errors:
error: pathspec ‘submodule’ did not match any file(s) known to git
error: pathspec ‘Standard’ did not match any file(s) known to git
error: pathspec ‘to’ did not match any file(s) known to git
error: pathspec ‘2024R2’ did not match any file(s) known to git
I suppose that my issue is related to this:
git_command = ‘git commit -m Moved submodule Standard to 2024R2
Moved submodule Common to 2024R2′
It seems that the system function can’t isolate correctly the "message" for the commit. How can i solve this one.
Thank you in advance.
Best regards.
Claudio Hello,
I’m trying to create a script to facilitate team member when they have to update submodules inside a project to a specific tag.
I have no problem for the upadate, but io’m quite stuck to the commit phase.
I try this list of commands:
commit_message = char(strcat("Moved submodule Standard to ", standard_tag, {newline}, "Moved submodule Common to ", common_tag));
git_command = [‘git commit -m ‘ commit_message];
system(git_command);
but, when i try to execute the script, i have this errors:
error: pathspec ‘submodule’ did not match any file(s) known to git
error: pathspec ‘Standard’ did not match any file(s) known to git
error: pathspec ‘to’ did not match any file(s) known to git
error: pathspec ‘2024R2’ did not match any file(s) known to git
I suppose that my issue is related to this:
git_command = ‘git commit -m Moved submodule Standard to 2024R2
Moved submodule Common to 2024R2′
It seems that the system function can’t isolate correctly the "message" for the commit. How can i solve this one.
Thank you in advance.
Best regards.
Claudio git, simulink, submodules, script MATLAB Answers — New Questions
How can I provide a custom abort message for the pre-commit hook for MATLAB R2024a and later?
How can I provide a custom abort message for the pre-commit hook for MATLAB R2024a and later?
I have already added corresponding echo commands to the pre-commit hook that show up correctly in Git Bash.
Checking this in MATLAB, the error message remains empty:
How can I ensure that the message shows up?How can I provide a custom abort message for the pre-commit hook for MATLAB R2024a and later?
I have already added corresponding echo commands to the pre-commit hook that show up correctly in Git Bash.
Checking this in MATLAB, the error message remains empty:
How can I ensure that the message shows up? How can I provide a custom abort message for the pre-commit hook for MATLAB R2024a and later?
I have already added corresponding echo commands to the pre-commit hook that show up correctly in Git Bash.
Checking this in MATLAB, the error message remains empty:
How can I ensure that the message shows up? MATLAB Answers — New Questions
Im experiencing misalignment of the crests in my normalized vertical velocity profiles when plotting multiple turbulence models; any suggestions on how to fix this?
Basically I had a running code for radial velocity contours which was fixed an all the crests aligned. Now i have changed the input files and associated names in the codes but the crests are not aligning, any and all help will be apreciatedBasically I had a running code for radial velocity contours which was fixed an all the crests aligned. Now i have changed the input files and associated names in the codes but the crests are not aligning, any and all help will be apreciated Basically I had a running code for radial velocity contours which was fixed an all the crests aligned. Now i have changed the input files and associated names in the codes but the crests are not aligning, any and all help will be apreciated plotting MATLAB Answers — New Questions
MATLAB runtime installer doesn’t launch on Macbook (with M3 chip)
I’m trying to install and configure MATLAB Runtime by following this article. I downloaded the corresponding installer for my macbook (arm64) and MATLAB version (MATLAB R2024a), and moved the installer in my app folder:
However, even if I double-click the app, it doesn’t display a dialog box. I allowed MATLAB to have a full disk access, but it didn’t fix the problem. Does anyone have similar experience?I’m trying to install and configure MATLAB Runtime by following this article. I downloaded the corresponding installer for my macbook (arm64) and MATLAB version (MATLAB R2024a), and moved the installer in my app folder:
However, even if I double-click the app, it doesn’t display a dialog box. I allowed MATLAB to have a full disk access, but it didn’t fix the problem. Does anyone have similar experience? I’m trying to install and configure MATLAB Runtime by following this article. I downloaded the corresponding installer for my macbook (arm64) and MATLAB version (MATLAB R2024a), and moved the installer in my app folder:
However, even if I double-click the app, it doesn’t display a dialog box. I allowed MATLAB to have a full disk access, but it didn’t fix the problem. Does anyone have similar experience? matlab runtime, mac MATLAB Answers — New Questions
How can I iterate through an array using a for loop?
I want to iterate through an array of file locations using a for loop.
My current code is something like this:
% Paths where the files are located
P1 = C:UsersmeDocuments\My Info
%Find excel files in path
%Pull data
% Write into a file
Now this code works great, but now I need to do the same thing to multiple paths while maintaining efficiency. To do this, I created an array of the paths I need to iterate through. How do I use a for loop to iterate through these paths? Here is what I have so far, but my code breaks when it tries to read the path because the text is not scalar when trying to use ‘dir’. Here is what I currently have:
% Paths where the files are located
P1 = C:UsersmeDocuments\My Info
P2 = C:UsersmeDocuments\My data
%Array of paths
Array = {‘P1, P2’}
for i = 1:length(Array)
%Find excel files in path
%Pull data
% Write into a fileI want to iterate through an array of file locations using a for loop.
My current code is something like this:
% Paths where the files are located
P1 = C:UsersmeDocuments\My Info
%Find excel files in path
%Pull data
% Write into a file
Now this code works great, but now I need to do the same thing to multiple paths while maintaining efficiency. To do this, I created an array of the paths I need to iterate through. How do I use a for loop to iterate through these paths? Here is what I have so far, but my code breaks when it tries to read the path because the text is not scalar when trying to use ‘dir’. Here is what I currently have:
% Paths where the files are located
P1 = C:UsersmeDocuments\My Info
P2 = C:UsersmeDocuments\My data
%Array of paths
Array = {‘P1, P2’}
for i = 1:length(Array)
%Find excel files in path
%Pull data
% Write into a file I want to iterate through an array of file locations using a for loop.
My current code is something like this:
% Paths where the files are located
P1 = C:UsersmeDocuments\My Info
%Find excel files in path
%Pull data
% Write into a file
Now this code works great, but now I need to do the same thing to multiple paths while maintaining efficiency. To do this, I created an array of the paths I need to iterate through. How do I use a for loop to iterate through these paths? Here is what I have so far, but my code breaks when it tries to read the path because the text is not scalar when trying to use ‘dir’. Here is what I currently have:
% Paths where the files are located
P1 = C:UsersmeDocuments\My Info
P2 = C:UsersmeDocuments\My data
%Array of paths
Array = {‘P1, P2’}
for i = 1:length(Array)
%Find excel files in path
%Pull data
% Write into a file matlab, for loop, array MATLAB Answers — New Questions
Using experimental data on geotrajectory function and checking trajectory dynamics with lookuPose function (SATCOM toolbox)
Hello everyone,
Im using SATCOM toolbox to evaluate a SATCOM link.
I have experimental flight profile data with a samplerate of 100Hz, that im using in the geotrajectory function
trajectory = geoTrajectory(Waypoints=[lat lon alt],TimeOfArrival=time,Velocities=[vnedx vnedy vnedz],ReferenceFrame="NED",Orientation=Euler);
then im using the lookupPose function to extract dynamical information
[position,orientation,velocity,acceleration,angularVelocity] = lookupPose(trajectory,time);
Finally, Im comparing the experimental data with the information provided by lookupPose.
Position, orientation and velocity matched the experimental data that was provided in the geotrajectory function.
I derived experimental acceleration using a forward difference numerical derivative of the experimental velocity data. When I compared this experimental acceleration data to the acceleration provided by the lookupPose, the results did not match exactly for velocity in x and y, but they were comparable. This is expected since the lookupPose might be using a different derivative method (see Figure below). However the velocity in z did not match at all.
The results shown above are derived using a sample rate of 1Hz ( I downsampled the experimental data). The problem arises when I increase the sample rate for example to 10 Hz. As seen in the images below the acceleration provide by the lookupPose function goes bersek.
My questions are:
Does the lookupPose function has a minimum sample rate limit (1Hz).
What is the numerical derivative used by the lookupPose function to calculate acceleration from velocity?
Is there a way to change the numerical derivative used by lookupPose to calculate acceleration?
Why does the Z component of acceleration does not match for a sample rate of 1Hz (even worse for 0.1 Hz).
As a reference these are the comparitions between experimental data of velocity ( given to geotrajetory ) and what the lookuppose outputs, (this comparisson is for 10Hz). The results are exactly the same.
Any help or guidance you could provide would be greatly appreciated. Thank you in advance for your assistance!.Hello everyone,
Im using SATCOM toolbox to evaluate a SATCOM link.
I have experimental flight profile data with a samplerate of 100Hz, that im using in the geotrajectory function
trajectory = geoTrajectory(Waypoints=[lat lon alt],TimeOfArrival=time,Velocities=[vnedx vnedy vnedz],ReferenceFrame="NED",Orientation=Euler);
then im using the lookupPose function to extract dynamical information
[position,orientation,velocity,acceleration,angularVelocity] = lookupPose(trajectory,time);
Finally, Im comparing the experimental data with the information provided by lookupPose.
Position, orientation and velocity matched the experimental data that was provided in the geotrajectory function.
I derived experimental acceleration using a forward difference numerical derivative of the experimental velocity data. When I compared this experimental acceleration data to the acceleration provided by the lookupPose, the results did not match exactly for velocity in x and y, but they were comparable. This is expected since the lookupPose might be using a different derivative method (see Figure below). However the velocity in z did not match at all.
The results shown above are derived using a sample rate of 1Hz ( I downsampled the experimental data). The problem arises when I increase the sample rate for example to 10 Hz. As seen in the images below the acceleration provide by the lookupPose function goes bersek.
My questions are:
Does the lookupPose function has a minimum sample rate limit (1Hz).
What is the numerical derivative used by the lookupPose function to calculate acceleration from velocity?
Is there a way to change the numerical derivative used by lookupPose to calculate acceleration?
Why does the Z component of acceleration does not match for a sample rate of 1Hz (even worse for 0.1 Hz).
As a reference these are the comparitions between experimental data of velocity ( given to geotrajetory ) and what the lookuppose outputs, (this comparisson is for 10Hz). The results are exactly the same.
Any help or guidance you could provide would be greatly appreciated. Thank you in advance for your assistance!. Hello everyone,
Im using SATCOM toolbox to evaluate a SATCOM link.
I have experimental flight profile data with a samplerate of 100Hz, that im using in the geotrajectory function
trajectory = geoTrajectory(Waypoints=[lat lon alt],TimeOfArrival=time,Velocities=[vnedx vnedy vnedz],ReferenceFrame="NED",Orientation=Euler);
then im using the lookupPose function to extract dynamical information
[position,orientation,velocity,acceleration,angularVelocity] = lookupPose(trajectory,time);
Finally, Im comparing the experimental data with the information provided by lookupPose.
Position, orientation and velocity matched the experimental data that was provided in the geotrajectory function.
I derived experimental acceleration using a forward difference numerical derivative of the experimental velocity data. When I compared this experimental acceleration data to the acceleration provided by the lookupPose, the results did not match exactly for velocity in x and y, but they were comparable. This is expected since the lookupPose might be using a different derivative method (see Figure below). However the velocity in z did not match at all.
The results shown above are derived using a sample rate of 1Hz ( I downsampled the experimental data). The problem arises when I increase the sample rate for example to 10 Hz. As seen in the images below the acceleration provide by the lookupPose function goes bersek.
My questions are:
Does the lookupPose function has a minimum sample rate limit (1Hz).
What is the numerical derivative used by the lookupPose function to calculate acceleration from velocity?
Is there a way to change the numerical derivative used by lookupPose to calculate acceleration?
Why does the Z component of acceleration does not match for a sample rate of 1Hz (even worse for 0.1 Hz).
As a reference these are the comparitions between experimental data of velocity ( given to geotrajetory ) and what the lookuppose outputs, (this comparisson is for 10Hz). The results are exactly the same.
Any help or guidance you could provide would be greatly appreciated. Thank you in advance for your assistance!. satellite communication toolbox, lookuppose function, acceleration MATLAB Answers — New Questions
¿How can I transform an already working code to a GUI?
I have a code that works fine and gives me the expected outputs. I don´t know how to transform that code into an app that asks me for the inputs and returns the plot of such result.I have a code that works fine and gives me the expected outputs. I don´t know how to transform that code into an app that asks me for the inputs and returns the plot of such result. I have a code that works fine and gives me the expected outputs. I don´t know how to transform that code into an app that asks me for the inputs and returns the plot of such result. gui, graphical interface, guide, appdesigner MATLAB Answers — New Questions
Matlab Runtime eval command permission denied
Hi,
I’m currently trying to get a compiled simulink model running inside a docker container. For this, I’m using the matlab runtime r2022b image from the docker hub. To futher investigate some errors, I started a virtual machine with ubuntu 20 and installed matlab runtime. When I try to run my application with the compiled bash script, I get: "Permission denied"
I installed matlab runtime on the user desktop and also in the standard folder, but it did not work.Hi,
I’m currently trying to get a compiled simulink model running inside a docker container. For this, I’m using the matlab runtime r2022b image from the docker hub. To futher investigate some errors, I started a virtual machine with ubuntu 20 and installed matlab runtime. When I try to run my application with the compiled bash script, I get: "Permission denied"
I installed matlab runtime on the user desktop and also in the standard folder, but it did not work. Hi,
I’m currently trying to get a compiled simulink model running inside a docker container. For this, I’m using the matlab runtime r2022b image from the docker hub. To futher investigate some errors, I started a virtual machine with ubuntu 20 and installed matlab runtime. When I try to run my application with the compiled bash script, I get: "Permission denied"
I installed matlab runtime on the user desktop and also in the standard folder, but it did not work. matlab runtime, linux, installation MATLAB Answers — New Questions
how to extract range of dates from timetable?
hi all,
The attached screenshot shows some data I need to extract based on time from the timetable.
For example, all measurements were collected on July 8, 2021, then all measurements were collected on July 9, 2021, and so on.
your help is appreciatedhi all,
The attached screenshot shows some data I need to extract based on time from the timetable.
For example, all measurements were collected on July 8, 2021, then all measurements were collected on July 9, 2021, and so on.
your help is appreciated hi all,
The attached screenshot shows some data I need to extract based on time from the timetable.
For example, all measurements were collected on July 8, 2021, then all measurements were collected on July 9, 2021, and so on.
your help is appreciated timetable MATLAB Answers — New Questions
How to solve the the parameter ‘SampleTime’ must be a real double scalar (period) or a real double vector of length 2 (period, offset).
the parameter ‘SampleTime’ must be a real double scalar (period) or a real double vector of length 2 (period, offset); where period, offset must be finite and non-negative and offset must be less than period.the parameter ‘SampleTime’ must be a real double scalar (period) or a real double vector of length 2 (period, offset); where period, offset must be finite and non-negative and offset must be less than period. the parameter ‘SampleTime’ must be a real double scalar (period) or a real double vector of length 2 (period, offset); where period, offset must be finite and non-negative and offset must be less than period. muthukumar ganesan MATLAB Answers — New Questions
Rename files in a folder
Hello. I have 21841 TIFF images in a folder with names in the format Camera10001, Camera10002,….Camera121841. I want to rename these files as:
Camera10001 to Camera0001, …. Camera121841 to Camera21841.
% Specify the input and output directories
input_directory = ‘D:ImagesTestCamera_1’;
output_directory = ‘D:ImagesTestCamera_1’;
% Ensure the output directory exists
if ~exist(output_directory, ‘dir’)
mkdir(output_directory);
endHello. I have 21841 TIFF images in a folder with names in the format Camera10001, Camera10002,….Camera121841. I want to rename these files as:
Camera10001 to Camera0001, …. Camera121841 to Camera21841.
% Specify the input and output directories
input_directory = ‘D:ImagesTestCamera_1’;
output_directory = ‘D:ImagesTestCamera_1’;
% Ensure the output directory exists
if ~exist(output_directory, ‘dir’)
mkdir(output_directory);
end Hello. I have 21841 TIFF images in a folder with names in the format Camera10001, Camera10002,….Camera121841. I want to rename these files as:
Camera10001 to Camera0001, …. Camera121841 to Camera21841.
% Specify the input and output directories
input_directory = ‘D:ImagesTestCamera_1’;
output_directory = ‘D:ImagesTestCamera_1’;
% Ensure the output directory exists
if ~exist(output_directory, ‘dir’)
mkdir(output_directory);
end rename, matlab MATLAB Answers — New Questions