回答済み
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...

約4年 前 | 0

| 採用済み

回答済み
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...

約4年 前 | 0

| 採用済み

回答済み
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...

約4年 前 | 0

回答済み
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...

約4年 前 | 0

| 採用済み

回答済み
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',...

約4年 前 | 0

| 採用済み

回答済み
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...

約4年 前 | 1

回答済み
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

約4年 前 | 0

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

約4年 前 | 1

| 採用済み

解決済み


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

約4年 前

解決済み


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

約4年 前

解決済み


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

約4年 前

回答済み
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)...

約4年 前 | 0

| 採用済み

解決済み


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

約4年 前

回答済み
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

約4年 前 | 0

| 採用済み

解決済み


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

約4年 前

解決済み


Remove the Zero
Given an array n, remove all zeros

約4年 前

回答済み
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,...

約4年 前 | 0

回答済み
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...

約4年 前 | 1

| 採用済み

回答済み
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(...

約4年 前 | 1

解決済み


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

約4年 前

解決済み


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

約4年 前

解決済み


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

約4年 前

解決済み


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

約4年 前

解決済み


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

約4年 前

解決済み


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

約4年 前

解決済み


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

約4年 前

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

約4年 前 | 0

回答済み
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)

約4年 前 | 0

| 採用済み

回答済み
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...

約4年 前 | 1

| 採用済み

回答済み
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,...

約4年 前 | 0

さらに読み込む