Respondida
how can i get different answers?
you can write this function function y=myfunction(L,t) a=L(:,1); b=L(:,2); c=L(:,3); y=(a./(b+c))*t; end then call this f...

alrededor de 4 años hace | 0

| aceptada

Respondida
How to split data of a .mat file into trainH trainY testH testY as shown in picture
My guess: 1st step: load your cmc.mat file in Variable A as a struct. 2nd step: extract your 4 variables from struct A. A=loa...

alrededor de 4 años hace | 0

| aceptada

Respondida
How to place values in a matrix with values from another matrix?
Year=[2018;2019;2020;2021;2022]; value1=[13;15;-76;-1;0]; table1=table2array(table(Year,value1)) Year2=[2018;2019;2020;2020;2...

alrededor de 4 años hace | 0

Respondida
Replace zeros with non-zero values from another array
output1=[71;0 ;74 ;75 ;85 ;0 ;88 ]; output2=[39242;32;8385 ;0;17854; 74 ;10499]; output1(output1==0)=output2(output1==0); out...

alrededor de 4 años hace | 0

| aceptada

Respondida
How to search a specific row and a column from a csv file that are associated with the date that was selected?
try this. please follow the dateformat whenever user put the date. I have attached a random csv file. data=readtable('VIX.csv',...

alrededor de 4 años hace | 0

| aceptada

Respondida
Transform table to another format
Headers = ["Fund1";"Fund2";"Fund3"]; Fund1 = [1;0.1;0.2]; Fund2 = [0.3;1;0.4]; Fund3 = [0.5;0.6;1]; correlData = table(Heade...

alrededor de 4 años hace | 1

Respondida
How to compare elements of a 2D array with other elements of the same array.
A=[1 2 3 ; 2 9 5; 4 1 8] [A1 C]=ismember(A(:),A); A2=sort(C); % sorting index A3=A(A2) % value of A those are identical

alrededor de 4 años hace | 0

Respondida
How to apply dec2bin on a string to get a single output?
a = '56515219790691171413109057904011688695424810155802929973526481321309856242040'; a1=cell2mat(split(a,' ')); a2=str2double...

alrededor de 4 años hace | 1

| aceptada

Resuelto


Back to basics 8 - Matrix Diagonals
Covering some basic topics I haven't seen elsewhere on Cody. Given an input vector of numbers, output a square array with the...

alrededor de 4 años hace

Resuelto


Back to basics 21 - Matrix replicating
Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, generate an output matrix that consists o...

alrededor de 4 años hace

Resuelto


Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
The given function returns the index of the maximum value in a given matrix. such as X=[4,3,4,5,9,12,0,5] Ans= 6 if maxim...

alrededor de 4 años hace

Respondida
Converting array to column matrix
use colon(:). each variable will be forced to be a column vector col_vector=Eflevel(:) if you want extract first 50 data(50*1)...

alrededor de 4 años hace | 0

| aceptada

Resuelto


Sum of odd numbers in a matrix
Find the sum of all the odd numbers in a matrix. Example x = [2 3 5 7 1 4 11] y = 27

alrededor de 4 años hace

Respondida
logical operation on matrix
A=[1 2 3;4 5 6; 4 5 2] B=rem(A,2) % returns the odd number output=A-B

alrededor de 4 años hace | 0

| aceptada

Resuelto


Product of Array
Given an array of numbers. Get the product of the array.

alrededor de 4 años hace

Resuelto


Remove the Zero
Given an array n, remove all zeros

alrededor de 4 años hace

Respondida
Extract the last day of each month in daily data set
if your data is arranged properly it would be 10227 rows from 1990 to 2017. then try this N=1990:2017; for i=1:length(N) A(i,...

alrededor de 4 años hace | 0

Respondida
Finding rows where the first column values are equal
A=[13453 10359 9955 5257 5299 5258 5849 3644 5848 5397 7230 5396 17132 17130 17118 4767 4768 4770 8291 8292 8316 3191 319...

alrededor de 4 años hace | 1

| aceptada

Respondida
How to create this patterned matrix?
try this: x=[0,8,7,6,5,4,3,2,1]; A1=circshift(x,1); A2=circshift(x,2); A3=circshift(x,3); A4=circshift(x,4); A5=circshift(...

alrededor de 4 años hace | 1

Resuelto


Back to basics 22 - Rotate a matrix
Covering some basic topics I haven't seen elsewhere on Cody. Rotate the input matrix 90 degrees counterclockwise (e.g. [1 2; ...

alrededor de 4 años hace

Resuelto


Divide by 4
Given the variable x as your input, divide it by four and put the result in y.

alrededor de 4 años hace

Resuelto


Max of a Vector
Write a function to return the max of a vector

alrededor de 4 años hace

Resuelto


"mirror" matrix
Create n x 2n "mirror" matrix of this type: Examples For n = 2 m = [ 1 2 2 1 1 2 2 1 ] For n = 3 m = ...

alrededor de 4 años hace

Resuelto


Insert zeros into vector
Insert zeros after each elements in the vector. Number of zeros is specified as the input parameter. For example: x = [1 ...

alrededor de 4 años hace

Resuelto


Rotate a Matrix by 90 degrees
Rotate a Matrix by 90 degrees Example: If the input is: X = 1 2 3 4 5 6 7 8 9 ...

alrededor de 4 años hace

Resuelto


Replace Vector Elements
Replace all elements in a vector which are equal to or smaller than zero with 0.1. Example: A = [1 2 3 -1 0 2 -3 -80]; ...

alrededor de 4 años hace

Respondida
Find a word in a text file and read values from that line
A=readtable('example2.txt','delimiter',':'); output=table2array(A(4,2))

alrededor de 4 años hace | 0

Respondida
Summing Certain pattern of elements in vector without using for loop
use reshape function A=[1 2 3 4 5 6 7 8]; output=sum(reshape(A,4,[]),1)

alrededor de 4 años hace | 0

| aceptada

Respondida
How to find the column index of the first nonzero element for every row of a given matrix
you can find your answer here https://www.mathworks.com/matlabcentral/answers/365710-how-to-find-first-1-in-every-row Just fol...

alrededor de 4 años hace | 1

| aceptada

Respondida
How to store the non zero value from each column of a matrix as a column vector (but if there is only zeros on the column store zero) in each iteration?
if there is only 1 zero in a column A=[0.38 0 0 0 0 5 0 0.58 0.71 0 0 5 0 0 5]; idx=A==0; for n=1:size(A,...

alrededor de 4 años hace | 0

Cargar más