Answered
I have a two column matrix and want to eliminate the rows whose interval contain a certain value
A=[12 44; 56 78; 81 100; 110 200; 210 300;450 500; 600 710] vec_control=[60 115 460] for iter=1:length(vec_contr...

2 years ago | 0

| accepted

Answered
Helping filling missing data with 0 value
data=importdata('test.txt') fullList=[(1:365)' zeros(365,1)]; partList=data(:,1); isPresent=ismember(fullList,par...

2 years ago | 0

| accepted

Answered
how do i use the strtok() function in combination with the while loop?
str='Welcome to the coffee shop' newStr=[] while length(str)~=0 [str, remain] = strtok(str) newStr=[ne...

2 years ago | 1

Answered
Sum of highest length of consecutive lowest values from a array.
A = [5 1 1 1 6 1 1 1 1 1 1 1 7 1 1 1 7] B=int32(A==min(A)); [startInd lastInd]=regexp(char(B+48),'[1]+'); counts=...

2 years ago | 0

Answered
I am looking to use a user input to define how many rand 1 row by 6 columns matrices i need
randi(53,x,6) Each row is a 'ticket'

2 years ago | 0

| accepted

Answered
My while loop is giving an error "Array indices must be positive integers or logical values." I'm trying to calculate the golden ratio within epsilon 0.001.
Probably something more like this: %Program Description: %This program takes 2 numerical inputs and calculates/estimates...

2 years ago | 1

| accepted

Answered
Building a vector array in for loop from if statements
You can build the output array dynamically. This is generally frowned upon, but unless the arrays are large it's unlikely to mak...

2 years ago | 1

| accepted

Answered
How to add variable names for each column when using array2table
a=[1 2 3 4 5 6 7;1 2 3 4 5 6 7] b=array2table(a,'VariableNames',{'col1','col2','col3','col4','col5','col6','col7'})

2 years ago | 0

| accepted

Answered
Displaying random image from array of file names
I have no idea what structure you have your image file names stored in, so I can only give an example of something that does wor...

2 years ago | 0

Answered
My professor assigned me to do the this homework with two numbers and writing a code that find which one is the prime for these two numbers
So what is the problem? The only obvious issue I see is that it doesn't check if the number is negative: function pr=Truepr...

2 years ago | 0

| accepted

Answered
Delete columns from a matrix
diff=size(class1,2)-size(class2,2) deletionList=randperm(size(class1,2),diff) class1(:,deletionList)=[]

2 years ago | 0

| accepted

Answered
How can i create a descriptive statistics table for columns
The default behavior for most of the statistical function is for column-wise operation and since that is what you want you can j...

2 years ago | 1

| accepted

Answered
How Do I use nested for loops to first go through every column, and then do a calculation for every row of that column.
matrix = csvread('M3_Data_HeatingTimeHistories2.csv') [rows,ncolumns] = size(matrix); % finds size of matrix ...

2 years ago | 0

Answered
Compute distances between an element and all other elements of a matrix
If you have the statistics toolbox you can use pdist2 m=[1 1 1 1;2 2 2 2;3 3 3 3;4 4 4 4;5 5 5 5] dist1=pdist2(m(1,:...

2 years ago | 0

| accepted

Answered
How to extract the string left and right to the matching alphabet
strs={'VA00K100E4TOO';'ZVA00K100E4TOO';'VZA00K100E6TO';'VB00K100E4TOO';'VP00K50E4T4O';'ZVG00K100E4TOO';'VF00K40E4T5O'} ...

2 years ago | 0

| accepted

Answered
Function definitions must appear at end of file
As it says, if you are going to have a function in the same file as a script, the function must go at the bottom. Until about ve...

2 years ago | 0

| accepted

Answered
For Loop operating with last and first entry of array
Like this? A=[1;5;6;8]; B=A(1:length(A))+[A(2:length(A));A(1)] B = 6 11 14 9

2 years ago | 0

Answered
If I have a 1 x 32 array with values, how can i manipulate the array into two variables in the following order ?
testMatrix=1:32; x=circshift(1:17,1) y=circshift(16:32,-1) testMatrix(x) testMatrix(y)

2 years ago | 0

Answered
Expanding array from seconds to samples
Something like this? bad_seconds = [1 2 11 13 14 15 17 18 22 24 26 27 37 47 48 50 57 58 70 75 90 118 120 144 145 147] ...

2 years ago | 0

| accepted

Answered
removing zeros from a matrix
x(x==0)=[]

2 years ago | 0

| accepted

Answered
I am getting that error explanation"function [out] = celsi2farh( x, i ) ↑ Error: Function definition not supported in this context. Create functions in code file." Could you please helpm me to get rid of this error ?
I think recent versions of Matlab (I don't know from which version) allow a function to be put on the bottom of a script file, b...

2 years ago | 0

Answered
How can I find the second last value of a vector?
W(end-1)

2 years ago | 2

| accepted

Answered
How to find multiple numbers in a matrix
A = [1 2 3 3 5 6; 7 8 3 3 5 12; 13 14 3 3 17 5]; b=A==3 | A==5

2 years ago | 0

Answered
creating function to find odd numbers upto 10000 having sum of its digits an odd number itself( e.g. 29)
%Create list of odd numbers as cell array of character vectors oddNum_str=regexp(num2str(1:2:10000),'\d+','match'); resu...

2 years ago | 0

Answered
"Subscript indices must either be real positive integers or logicals."
if the number of words is low (as it would get after a few repetitions) and rand is small, then the index could potentially be 0...

2 years ago | 0

Answered
How can I have a function that has a string as the input.
You need to use strcmp(string1,string2) to compare as the size of the color variable might be a different length to whatever fix...

2 years ago | 0

Answered
is it possible to restart progress of self-paced course
As far as I remember I went back and redid parts that I'd forgotten about. The progress doesn't reset, but it doesn't stop you r...

2 years ago | 0

Answered
Why is the min() and max() function throwing an error?
min(outFHN) ans = -4.1601 I would assume that you have a variable called min in your workspace which is sh...

2 years ago | 0

| accepted

Answered
mean of elements of a matrix
mean(A(:)) Gives the mean of the entire matrix

2 years ago | 0

| accepted

Load more