Beantwortet
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...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
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...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
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...

fast 4 Jahre vor | 0

Beantwortet
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...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
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',...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
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...

fast 4 Jahre vor | 1

Beantwortet
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

fast 4 Jahre vor | 0

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

fast 4 Jahre vor | 1

| akzeptiert

Gelöst


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...

fast 4 Jahre vor

Gelöst


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...

fast 4 Jahre vor

Gelöst


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...

fast 4 Jahre vor

Beantwortet
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)...

fast 4 Jahre vor | 0

| akzeptiert

Gelöst


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

fast 4 Jahre vor

Beantwortet
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

fast 4 Jahre vor | 0

| akzeptiert

Gelöst


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

fast 4 Jahre vor

Gelöst


Remove the Zero
Given an array n, remove all zeros

fast 4 Jahre vor

Beantwortet
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,...

fast 4 Jahre vor | 0

Beantwortet
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...

fast 4 Jahre vor | 1

| akzeptiert

Beantwortet
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(...

fast 4 Jahre vor | 1

Gelöst


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; ...

fast 4 Jahre vor

Gelöst


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

fast 4 Jahre vor

Gelöst


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

fast 4 Jahre vor

Gelöst


"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 = ...

fast 4 Jahre vor

Gelöst


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 ...

fast 4 Jahre vor

Gelöst


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 ...

fast 4 Jahre vor

Gelöst


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]; ...

fast 4 Jahre vor

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

fast 4 Jahre vor | 0

Beantwortet
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)

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
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...

fast 4 Jahre vor | 1

| akzeptiert

Beantwortet
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,...

fast 4 Jahre vor | 0

Mehr laden