Solved


The average of the second largest values
Given a matrix, find the average of the second largest values in each row. The same value does not exist on a row. Example: ...

4 years ago

Solved


The great 82-year-old
Let's answer the question below; 'I am *x* years old and I have never written programs. If I study from now, will I be able ...

4 years ago

Solved


DC-DC boost converter
Find the output voltage of a DC-DC boost converter given input voltage and the duty cycle ratio

4 years ago

Answered
When you enter something invalid, your program should not stop, and should keep asking for a number
function g = get_valid_grade while 1 g = input('Enter Score(0 - 100): ','s'); g=str2double(g); if g<=...

4 years ago | 0

| accepted

Answered
Capture reaction time to specific button press
Take a look at my Psychomotor Vigilance Task code: https://www.mathworks.com/matlabcentral/fileexchange/106625-psychomotor-vigi...

4 years ago | 0

Answered
Problem with Cell Array in Table
Why not just a matrix? It does not seem like you have any field names. M=[]; for k=1:5 M=[M;T.Var1{k}]; end

4 years ago | 0

| accepted

Answered
I want to convert the resulting 8 bit binary bits back to quantization levels
s=randi(256,1,1000)-1;%quantized signal b=dec2bin(s',8)'; b=b(:)';%binary character signal B=b-'0';%binary array signal r=re...

4 years ago | 1

Answered
Find consecutive ones and save the contents
s=num2str(ind6(:,2)'); s=s(s~=' '); [Start,End]=regexp(s,'[1]{2,}'); for k=1:length(Start) c{k}=ind6(Start(k):End(k),1)';...

4 years ago | 1

| accepted

Answered
picking numbers from matrix
A=[0 4 8 5 0 0 0 4 6 2 8 0 0 0 7]; for k=1:size(A,2) r=unique(A(:,k)); r=r(r~=0); B(:,k)=r(randi...

4 years ago | 0

| accepted

Answered
Normalizing histogram counts to 1
Don't you want probability. histogram(Output, 'Normalization', 'probability');

4 years ago | 0

Answered
how to count array of 1 and 0 repeated times
a=ones(1,10); b=[]; for k=1:10 b=[b,randi(2,1,20)-1,a]; end % above just generates binary series s=num2str(b); s=s(s~='...

4 years ago | 0

Answered
Having problem in for loop, Can you guys please help me?
If you can advoid it, you should never make multiple variables but should place them all in a matrix. If ROI_Mask's are matrices...

4 years ago | 0

| accepted

Answered
combine matrix from different matrix
C=reshape([A;B],size(A,1),[]);

4 years ago | 0

| accepted

Answered
How to stop the axes from changing within loop without defining them every iteration
Why not just move it outside the loop? hf = figure(1); hold on rectangle('Position',[-0.1 -0.1 10.2 4.9]) for i = 1:length(Y...

4 years ago | 0

Answered
How can I print row number to matrix in matlab?
M=randi(2,10,3)-1;%sample matrix newM=M.*(1:size(M,1))';

4 years ago | 0

| accepted

Answered
for loop question (column vector?)
Of course you will get NAN for log(0) RT_W = [0.4;0.5;0.6]; x1 = 0:0.01:1; x2=1-x1; for k=1:length(RT_W) dG_W(k,:)=RT_W...

4 years ago | 0

| accepted

Answered
Code not graphing properly?
K_traction = K_m*(1+(f_i*((K_m/(K_m-K_i))-s1)^-1).^-1);%just missing a dot .^-1

4 years ago | 0

Answered
How to fit an exponential curve for every column in a matrix?
for k=1:36 B{k}=fit((1:257)',A(:,k),'exp1'); end

4 years ago | 0

| accepted

Solved


To Bet or Not to Bet
Given your current poker hand, the visible cards of your opponent's hand, and the total number of cards being dealt (5 card stud...

4 years ago

Problem


To Bet or Not to Bet
Given your current poker hand, the visible cards of your opponent's hand, and the total number of cards being dealt (5 card stud...

4 years ago | 0 | 3 solvers

Answered
How can I put an image over another in a specific coordinate?
row=256; col=256; img=ones(row,col); img(100:190,100:170)=0;%why not just override the image at the pixel locations imshow(i...

4 years ago | 0

Answered
create a loop to give any number , instead of entering values manually
Still not sure what you are trying to do. x = 0:0.1:5; Fplot = zeros(length(x),NumStates); F=Fplot;%preallocate F for i = 1:...

4 years ago | 0

Answered
How to calculate a mean of column one across multiple tables?
m=sum(arrayfun(@(x)sum(table2array(c{x}(:,1))),1:18))/1800;% c is your cell array, this finds mean of first columns loop to fin...

4 years ago | 0

| accepted

Answered
How to set upper and lower limit of random number
dataSet=50*rand(1,1000)+300;

4 years ago | 0

Answered
Encrypt and Decrypt “ABZSTYXN” using the key k=7 by shift￾cipher method.
key=7; msg='ABZSTYXN'; encrypt=char(mod(msg-'A'+key,26)+'A'); decrypt=char(mod(encrypt-'A'-key,26)+'A');

4 years ago | 0

Answered
Use the values in one matrix as index values to another matrix and replace with a value
The sizes of A and B in your example are not the same. m=max(A,[],'all'); B=zeros(m,size(A,2)); a=A+(0:m:m*(size(A,2)-1)); B...

4 years ago | 0

Answered
How to define a variable as a condition of other variables
TSI=1000:2000; T=(TSI/r^2/SB_constant*L^2).^.25;

4 years ago | 0

Answered
How do you extract the elements of a cell that have the largest length?
[s,d] = cellfun(@size,A); m = max([s,d],[],'all'); idx=s==m|d==m; Anew=A(idx);

4 years ago | 0

Answered
ERROR : Unrecognized function or variable , Index exceeds the number of array elements
er1 = 2.55; er2 = 1; eta_1 = 377; eta_2 = 377/sqrt(er1); sin_theta_b = 1/sqrt(1+er1/er2);%just a scalar sin(theta_b) makes n...

4 years ago | 0

Answered
How can I randomly select 1000 small matrix like 11X11 from 7081X7811 matrix size?
r=randi(7070,1000,1); c=randi(7800,1000,1); for k=1:1000 newMatrix(:,:,k)=yourMatrix(r(k):r(k)+11,c(k):c(k)+11); end

4 years ago | 0

Load more