Answered
Find column number for every row in matrix
a=[ -1 4 1 1 -1 -1 -5 4 -1]; A=(a>0)'; [b,d]=find(A); [~,e]=unique(d); b(e)

3 years ago | 0

Answered
How do I crop a matrix within desired numerical limits?
M=[-2+16*rand(100,1),-17+9*rand(100,1),-3+5*rand(100,1)]; M(M(:,3)<-2|M(:,3)>1,:)=[]; M(M(:,2)<-16|M(:,2)>-9,:)=[]; M(M(:,1)<...

3 years ago | 0

Answered
How to select vectors from a set of vectors
x=[1 1 1 1 0 0 0 0;1 0 0 0 1 1 1 0;0 1 0 0 1 0 0 1;0 0 1 0 0 1 0 1;0 0 0 1 0 0 1 0]; r=randi(8,1,500); y=x(:,r)

3 years ago | 1

| accepted

Answered
I need to combine those three martix into a single big one. How do I do that?
blkdiag(randi(10,2),randi(10,2),randi(10,2))

3 years ago | 0

Answered
Compare vector to two other vectors
m=randi(100,1,20); n=randi(100,1,30); k=randi(100,1,10000); [M,N]=meshgrid(m,n); x=min(M,N); z=zeros(size(x)); u=unique(x)...

3 years ago | 0

Answered
Function might not be used error
[e,t,a]=CalcTip(100,3) [e,t,a]=CalcTip(100,4) [e,t,a]=CalcTip(100,5) [e,t,a]=CalcTip(100,2) function[error, tip, amoun...

3 years ago | 0

Answered
Having trouble converting rpm to 1/s using unitConvert from symunit
You want rps u = symunit; n = 2950 * u.rpm; w = vpa(unitConvert(n,u.rps))

3 years ago | 1

Answered
creating an array from a single user input
userinput = input('input nth value for fibonacci calculation:'); %define two empty matrices one for fibonacci values and one fo...

3 years ago | 0

| accepted

Answered
low quality figure problem when saving as svg or pdf ( using fill function)
How is the quality different? My saved pdf looks just the same. x=rand(10,10); y=rand(10,10); z=rand(10,10); figure,axis equ...

3 years ago | 1

Answered
Mask with a for loop
removeData([2 3 0 0 7 8 0]) function [newVec] = removeData(vec) newVec = zeros(size(vec)); for x = 1:length(vec) %don't hav...

3 years ago | 0

Answered
Easiest way to check if the point is on the land or on sea?
Do you have the mapping toolbox? Use https://www.mathworks.com/matlabcentral/fileexchange/48661-landmask If so it is as simple a...

3 years ago | 0

| accepted

Answered
How can I load data from Excel file to Matlab in script and use the data loaded to calculate?
MSU1=readmatrix('Relaxation data.xlsx','Range','A4:E82')%load the others following the same method

3 years ago | 1

Answered
t test ( not sure if my implementation is correct)
N=randi(100,5,4);%your matrix; R=randi(100,5,4);%your matrix h=1; for n=1:4 for r=1:4 H(h)=ttest(N(:,n),R(:,r));...

3 years ago | 0

| accepted

Answered
How can I load data from Excel file to Matlab in script and use the data loaded to calculate?
Use readmatrix or readtable. If you attach your spreadsheet we could help more.

3 years ago | 1

Answered
Greek character print in the command window, but not when I publish a script.
display(char(945)); display(char(946));

3 years ago | 0

Answered
how to use elements from array to sort data
Keep your data stored in matrices that you can index into. numdata = xlsread("res Data.xlsx"); Q=numdata(1:5,:); F=numdata(6:...

3 years ago | 1

Answered
How to create a function which takes one column of data as its input and another as its output
Just use the find function. find rng(1) A=randi(100,10,2) f=A(find(A(:,2)==88),1)

3 years ago | 0

| accepted

Answered
Bessel Function Calculation in Matlab
You need to increase your k as z gets larger. n=sym(1); F(1)=n; for k=1:202 F(k+1)=F(k)*k; end J=zeros(1,60); for z=1:...

3 years ago | 2

Solved


Sequence problem
find the nth term of the sequence: 790 1303 2033 ____ 4366 6095

3 years ago

Answered
product between doubles 200*200
F= 1 -((1-prob1).*(1-prob2).*(1-prob3));

3 years ago | 0

| accepted

Solved


Repeat a string (not a character array)
True string are a relatively recent addition to MATLAB, first having been available in R2016. Strings contrast with character ar...

3 years ago

Solved


Median filter over three values
Implement 1-D median filter over input vector x as described: Moving window size is 3 Output is middle/central value in moving...

3 years ago

Solved


Generate Hadamard Matrix
In mathematics, a Hadamard matrix, named after the French mathematician Jacques Hadamard, is a square matrix whose entries are e...

3 years ago

Answered
How to make a 'case' go over each element in a vector ?
tcue = TIMES+floor(NS)-0.5;

3 years ago | 0

Answered
Randomize vector avoiding consecutive values
leftSides = [1,3,5]; leftPos_trials = repmat(leftSides,1,14); idx=randperm(42); while any(diff(leftPos_trials(idx))==0) ...

3 years ago | 0

Answered
Iteration over for loop using a vector
n_trial = 12; n_probe =7; longer_array = [1:84]; for trial = 1:n_trial for probe = 1:n_probe longer_array((trial...

3 years ago | 0

| accepted

Load more